From: | "Rob" <rob(at)jamwarehouse(dot)com> |
---|---|
To: | "pgNovice" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Limiting the result set |
Date: | 2002-08-16 08:06:23 |
Message-ID: | MIENLCBGIJDKLHHBLCDGIELKCAAA.rob@jamwarehouse.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi guys,
I got a bit of an interesting problem I'm hoping someone can help me solve.
I've got a table that's got over 12000 entries in it and user's can run
searches on it via the
web. Now, I only ever want to return a maximum of 500 results (for speed
purposes) for any search.
Now, I've got that right by using the LIMIT command, but I also want to be
able to tell the user
how many records matched their search criteria. So I want to say something
like
"Your search matched 1234 items. These are the first 500" or some such
thing.
Is there any way, IN ONE QUERY, to do this. So I want to basically return
the first 500 results
and a count of the total result set in one go. Is this possible?
If not, what would be the quickest way to do this? The reason I need one
query is because I use
dynamic SQL, which complicates stuff a bit more
Thanks
Rob
---
He who dies with the most toys ...
... still dies
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2002-08-16 12:40:22 | Re: Limiting the result set |
Previous Message | Jules Alberts | 2002-08-16 07:56:01 | Re: pg_restore problem |