Autoincrement value in a SELECT statement - Mailing list pgsql-sql

From JORGE MALDONADO
Subject Autoincrement value in a SELECT statement
Date
Msg-id CAAY=A78V4h_iyy-_Yq+0jDiu+GzNMXLP3adgfd=EuwZM5GyOiA@mail.gmail.com
Whole thread Raw
Responses Re: Autoincrement value in a SELECT statement  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Herby Raynaud
Date:
Subject: Wiindow Aggregate function
Next
From: Tom Lane
Date:
Subject: Re: Autoincrement value in a SELECT statement