From: | "Mitch Vincent" <mitch(at)doot(dot)org> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Way to use count() and LIMIT? |
Date: | 2001-12-19 00:24:39 |
Message-ID: | 010401c18823$8c8abce0$0200000a@Mitch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
see http://www.php.net/manual/en/function.pg-numrows.php
Still, this isn't what you want I'd say.. That just gives you the number of
rows returned by a query -- a query that uses LIMIT X return X or less
records, so that's not the most that pg_numrows() will ever give you is X...
I've run into this before when I did some search engine work with PG, it's a
pain but I've found no workaround... I ended up having to do two queries,
one a count() and one to return the records...
-Mitch
----- Original Message -----
From: "Doug McNaught" <doug(at)wireboard(dot)com>
To: "SHELTON,MICHAEL (Non-HP-Boise,ex1)" <michael_shelton(at)non(dot)hp(dot)com>
Cc: <joe(at)jwebmedia(dot)com>; <pgsql-general(at)postgresql(dot)org>
Sent: Tuesday, December 18, 2001 4:49 PM
Subject: Re: [GENERAL] Way to use count() and LIMIT?
> "SHELTON,MICHAEL (Non-HP-Boise,ex1)" <michael_shelton(at)non(dot)hp(dot)com> writes:
>
> > Sorry I haven't been able to get back to you -- busy at work.
> >
> > One last comment to try is in MS SQL you can get the number of rows
returned
> > via @@ROW_COUNT -- however I couldn't find the equivalent for PG SQL
> > (doesn't mean there isn't one).
> >
> > Anyone else know what might work here? The important detail is wanting
to
> > get a number of rows in the _result_ not necessarily the table.
>
> libpq gives you this information via the PQntuples() function.
> Whether PHP gives you access to that info I don't know--see your docs.
>
> -Doug
> --
> Let us cross over the river, and rest under the shade of the trees.
> --T. J. Jackson, 1863
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2001-12-19 01:52:41 | Re: Way to use count() and LIMIT? |
Previous Message | Stephan Szabo | 2001-12-18 23:55:12 | Re: another foreign key question |