total row count for selects with a limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi there,
 
what seems to be the best way of getting the total row number on select queries with a limit on them?
 
What I am currently thinking of doing is building select queries dynamically and wrapping all selected fields into the count() function without the limit
 
somthing like:
 
select a,b,c from table limit 10
 
and for total count
 
select count(a,b,c) from table
 
and a function to build the select query with parameters such as
 
function build_select($table, $cols=array(), $limit, $orderby, $where) { ... }
 
I am going in the right direction? Instead of one query I need 2 is there a way of making it just one query?
 
thanks for any help
 
regards, Peter

[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux