retrieve row number

From: "Pascal Tufenkji" <ptufenkji(at)usj(dot)edu(dot)lb>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: retrieve row number
Date: 2006-12-01 06:31:41
Message-ID: 000301c71512$5f773130$ef64a8c0@pascolo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Can I retrieve the row number in a select statement?

For example : if I have the following table "foo"

col1 | col2

-----+-----

a | x

b | y

c | z

select ?? as row_number, col1, col2 from foo;

I should obtain the following result :

row_number | col1 | col2

-----------+------+-----

1 | a | x

2 | b | y

3 | c | z

Thank you

Pascal

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2006-12-01 06:56:20 Re: retrieve row number
Previous Message imad 2006-11-30 20:24:49 Re: [SQL] Grants