Re: Planning aggregates which require sorted or distinct

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Planning aggregates which require sorted or distinct
Дата
Msg-id 10346.1169276747@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Planning aggregates which require sorted or distinct  (Gavin Sherry <swm@alcove.com.au>)
Ответы Re: Planning aggregates which require sorted or distinct  (Markus Schiltknecht <markus@bluegap.ch>)
Re: Planning aggregates which require sorted or distinct  (Gavin Sherry <swm@alcove.com.au>)
Список pgsql-hackers
Gavin Sherry <swm@alcove.com.au> writes:
> We want to answer the following: for each employee: what is their rank in
> terms of salary and what is their rank in terms of age. This query
> answers that:

> select empno, rank() over (order by salary) as srank,
>   rank() over (order by age) as arank
>   from employees order by empno;

Eeek.  This seems like the worst sort of action-at-a-distance.  How does
rank() know what value it's supposed to report the rank of?
        regards, tom lane


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

Предыдущее
От: Dennis Bjorklund
Дата:
Сообщение: Re: savepoint improvements
Следующее
От: Markus Schiltknecht
Дата:
Сообщение: Re: Planning aggregates which require sorted or distinct