Limiting the result set

Поиск
Список
Период
Сортировка
От Rob
Тема Limiting the result set
Дата
Msg-id MIENLCBGIJDKLHHBLCDGIELKCAAA.rob@jamwarehouse.com
обсуждение исходный текст
Ответ на Re: Forgotten the master password of db  (Josh Berkus <josh@agliodbs.com>)
Ответы Re: Limiting the result set  (Bruno Wolff III <bruno@wolff.to>)
Список 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



В списке pgsql-novice по дате отправления:

Предыдущее
От: "Jules Alberts"
Дата:
Сообщение: Re: pg_restore problem
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Limiting the result set