1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

laravel pagination count in first query

Discussão em 'Outras Linguagens' iniciado por gerl, Outubro 3, 2024 às 13:22.

  1. gerl

    gerl Guest

    Why cant laravel pagination use the temp_table to get the count instead of the user table? I use unions between 3 queries and when i paginate, i run into

    Column not found : Unknown column 'usr_users.id' in field list


    Query in question looks like:

    (select count(distinct `usr_users`.`id`) as aggregate from ((select distinct usr_users.id as id,
    ...
    ) order by `name` asc) as `temp_table`)


    but when i change the above to

    (select count(distinct `temp_table`.`id`) as aggregate from ((select distinct usr_users.id as id,
    ...
    ) order by `name` asc) as `temp_table`)


    The count returns properly. Is there a way to change this query?? btw the subquery does work. I do have usr_users.id column.

    Continue reading...

Compartilhe esta Página