Search Postgresql Archives

oracle rank() over partition by queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux