Ranking?

Поиск
Список
Период
Сортировка
От Ruben Gouveia
Тема Ranking?
Дата
Msg-id 1219440646.27860.17.camel@dina2.dhcp.2wire.com
обсуждение исходный текст
Ответы Re: Ranking?  (David Fetter <david@fetter.org>)
Список pgsql-general
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.

rank | value
------------
     | 100
------------
     | 300
------------
     | 200
------------

Now, how do i create a FOR LOOP that will populate the rank column of
this table given the results of the cursor.

Ideally, i would want the FOR LOOP too look at the results of the query
results of my cursor and populate each row accordingly and my insert
statement would then populate the table and it will look like this

rank | value
------------
  1  | 300
------------
  2  | 200
------------
  3  | 100
------------

so in simple terms, i guess i need somekind of iteration based on the
values...

any examples out there?



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

Предыдущее
От: "Anderson dos Santos Donda"
Дата:
Сообщение: Re: Installing Postgre 8.3 with a command
Следующее
От: "Gustavo Ces"
Дата:
Сообщение: Can´t write nothing in \bin folder in windows