select count(*) and limit

Поиск
Список
Период
Сортировка
От Verena Ruff
Тема select count(*) and limit
Дата
Msg-id 446C519E.6050507@triosolutions.at
обсуждение исходный текст
Ответы Re: select count(*) and limit  (Sean Davis <sdavis2@mail.nih.gov>)
Re: select count(*) and limit  (Oscar Rodriguez Fonseca <info@vraniscci.com>)
Список pgsql-novice
Hi,

sometimes I have queries with a LIMIT statement. Now I'd like to present
the user the returned records and inform him how many records there are
if there was no LIMIT statement. Is it possible to get all neccessary
information with one query?
This works:
SELECT * FROM table LIMIT 20
SELECT count(*) FROM table
But is it possible to have one query returning both, the records and the
count?

regards,
Verena

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Querying from two tables as if they were appended
Следующее
От: Sean Davis
Дата:
Сообщение: Re: select count(*) and limit