Gavin Sherry <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to