Received: from [203.3.121.10] (jafar.unixpac.com.au [203.3.121.10]) by postgresql.org (8.11.3/8.11.4) with SMTP id fAQLrgm34656 for ; Mon, 26 Nov 2001 16:53:42 -0500 (EST) (envelope-from peterh@600ml.com.au) Received: from no.name.available by [203.3.121.10] via smtpd (for postgresql.org [64.49.215.8]) with SMTP; 26 Nov 2001 21:57:54 UT Received: from 600mlPeterPC1 (localhost.localdomain [127.0.0.1]) by eeyore.unixpac.com.au (Postfix) with SMTP id C683918FFD for ; Tue, 27 Nov 2001 08:52:35 +1100 (EST) Message-ID: <005001c176c3$ef8d4e00$0300000a@600mlPeterPC1> Reply-To: "Peter" From: "Peter" To: "PostgreSQL PHP" Subject: total row count for selects with a limit Date: Tue, 27 Nov 2001 08:47:24 +1100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_004D_01C17720.22AFCD10" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200111/132 X-Sequence-Number: 773 This is a multi-part message in MIME format. ------=_NextPart_000_004D_01C17720.22AFCD10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi there, what seems to be the best way of getting the total row number on select que= ries with a limit on them? What I am currently thinking of doing is building select queries dynamicall= y and wrapping all selected fields into the count() function without the li= mit=20 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=3Darray(), $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 ------=_NextPart_000_004D_01C17720.22AFCD10 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi there,
 
what seems to be the best way of getting t= he total=20 row number on select queries with a limit on them?
 
What I am currently thinking of doing is b= uilding=20 select queries dynamically and wrapping all selected fields into the count(= )=20 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 w= ith=20 parameters such as
 
function build_select($table, $cols=3Darra= y(),=20 $limit, $orderby, $where) { ... }
 
I am going in the right direction? Instead= of one=20 query I need 2 is there a way of making it just one query?
 
thanks for any help
 
regards, Peter
------=_NextPart_000_004D_01C17720.22AFCD10--