[GENERAL] Ranking?

2008-08-22 Thread Ruben Gouveia
Since there is no current solution to ranking values in pl/pgsql as the rank() over (partition by... that there is in oracle i am hoping someone can help me out here. The table i created contains the following columns: rank | value I wrote a cursor that will give me all the values.

[GENERAL] oracle rank() over partition by queries

2008-08-21 Thread Ruben Gouveia
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 cos