total row count for selects with a limit

From: "Peter" <peterh(at)600ml(dot)com(dot)au>
To: "PostgreSQL PHP" <pgsql-php(at)postgresql(dot)org>
Subject: total row count for selects with a limit
Date: 2001-11-26 21:47:24
Message-ID: 005001c176c3$ef8d4e00$0300000a@600mlPeterPC1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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

Browse pgsql-php by date

  From Date Subject
Next Message Dan Wilson 2001-11-27 02:15:52 Re: Connection problem
Previous Message Millsap, Michael G 2001-11-26 20:08:02 PostgreSQL pseudo cluster