oracle rank() over partition by queries

Started by Ruben Gouveiaover 17 years ago2 messagesgeneral
Jump to latest
#1Ruben Gouveia
rgouveia@2wire.com

Does postgreSQL have an equivalent of the Oracle's "rank() over by
partition"?

Here's what i have so far but it doesn't work:

select id,
sum(case when key = 5 then 1 else 0 end),
sum(case when key = 6 then 1 when key = 7 then 1 else 0 end),
sum(case when l.status = 6 then cost when key = 7 then cost else
0 end),
RANK() OVER (ORDER BY sum(case when key = 6 then 1 when key = 7
then 1 else 0 end) DESC) AS RANK
from mytable
group by id

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ruben Gouveia (#1)
Re: oracle rank() over partition by queries

Ruben Gouveia <rgouveia@2wire.com> writes:

Does postgreSQL have an equivalent of the Oracle's "rank() over by
partition"?

No. There's some work in progress that might or might not be ready
in time for 8.4 ...

regards, tom lane