sequence number in a result

From: "Campbell, Lance" <lance(at)illinois(dot)edu>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: sequence number in a result
Date: 2008-10-09 16:31:05
Message-ID: B10E6810AC2A2F4EA7550D072CDE876001D20985@SAB-FENWICK.sab.uiuc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Say I have the following SQL statement:

SELECT a, b, c FROM t1 ORDER BY a;

Is there a function or special system label I can use that would
generate a sequence number in the returning result set?

Example:

SELECT a, b, c, SOMELABEL as order FROM t1 ORDER BY a;

Result:

a b c order

---------------------

Aa bb cc 1

A1 bb cc 2

A2 bb cc 3

Thanks,

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu <http://webservices.uiuc.edu/>

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Oliveiros Cristina 2008-10-09 16:48:00 Re: sequence number in a result
Previous Message Sabin Coanda 2008-10-09 09:37:09 Re: 100% CPU at concurent access