Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query?

Поиск
Список
Период
Сортировка
От Perry Smith
Тема Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query?
Дата
Msg-id 8D4B16FB-BE56-446E-BDE5-D12C69B2C3DB@easesoftware.com
обсуждение исходный текст
Ответ на Re: Can I get the number of results plus the results with a single query?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query?  (Rob Sargent <robjsargent@gmail.com>)
Список pgsql-general


On Aug 15, 2022, at 08:55, David G. Johnston <david.g.johnston@gmail.com> wrote:

On Monday, August 15, 2022, Perry Smith <pedz@easesoftware.com> wrote:
I’ve been toying with row_number() and then sort by row_number descending and pick off the first row as the total number. 

Use count as a window function.

I see others are commenting after David’s update so:

Thank you David.

This seems to work for me:

SELECT count(*) OVER (), id, basename, sha1 FROM dateien WHERE (lower(ext) in ( 'pxd' ) and ftype = 'file') ORDER BY sha1;

This has, e.g. 73, in the first column for all of the rows.

Вложения

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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Can I get the number of results plus the results with a single query?
Следующее
От: Rob Sargent
Дата:
Сообщение: Re: ***SPAM*** Re: Can I get the number of results plus the results with a single query?