Re: [NOVICE] Please advice on a query

Поиск
Список
Период
Сортировка
От Lutz Horn
Тема Re: [NOVICE] Please advice on a query
Дата
Msg-id 5440f7e2-5885-306f-0acc-ea69e039d98b@posteo.de
обсуждение исходный текст
Ответ на Re: [NOVICE] Please advice on a query  (Efraín Déctor <efraindector@motumweb.com>)
Список pgsql-novice
Hi,

Am 14.11.17 um 18:19 schrieb Efraín Déctor:
> You could use a window function:
> https://www.postgresql.org/docs/current/static/functions-window.html

Like this:

lutz=> \d dates Table "pg_temp_3.dates"Column | Type | Modifiers
--------+------+-----------d      | date |

lutz=> select * from dates;    d
------------2017-01-012017-01-012017-10-152017-10-152017-10-152017-11-092017-11-092017-11-092017-11-09
(9 rows)

lutz=> select d from ( select d, rank() over (order by d desc) as r from dates
) as sq
where r = 1;    d
------------2017-11-092017-11-092017-11-092017-11-09
(4 rows)

Regards

Lutz



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

Предыдущее
От: Efraín Déctor
Дата:
Сообщение: Re: [NOVICE] Strange problem with autovacuum
Следующее
От: JORGE MALDONADO
Дата:
Сообщение: [NOVICE] How to get n records from parent table and their children