Autoincrement value in a SELECT statement

Поиск
Список
Период
Сортировка
От JORGE MALDONADO
Тема Autoincrement value in a SELECT statement
Дата
Msg-id CAAY=A78V4h_iyy-_Yq+0jDiu+GzNMXLP3adgfd=EuwZM5GyOiA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Autoincrement value in a SELECT statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Hi,

Let's suppose that I have a table like this:

team_name       varchar(120)
score                integer

I have a "SELECT team_name, score FROM teams ORDER BY score DESC". This mean that the first position belongs to the highest score, second position to the next score, and so on.What I need is to have the position.

position 1 for the highesst score
position 2 for the next score
.
.
.

Is it possible to include a field in the SELECT statement which "kind of autoincrements" so I can get the position?

Respectfully,
Jorge Maldonado

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

Предыдущее
От: Herby Raynaud
Дата:
Сообщение: Wiindow Aggregate function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Autoincrement value in a SELECT statement