Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A087D9F9FDA for ; Fri, 1 Dec 2006 02:41:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 28063-01 for ; Fri, 1 Dec 2006 02:41:25 -0400 (AST) X-Greylist: delayed 00:12:29.450974 by SQLgrey-1.7.4 Received: from Citrus.usj.edu.lb (rectorat2.usj.edu.lb [193.227.187.140]) by postgresql.org (Postfix) with ESMTP id 563779F9EED for ; Fri, 1 Dec 2006 02:41:23 -0400 (AST) Received: from pascolo ([192.168.100.239]) by Citrus.usj.edu.lb (8.13.1/8.13.1) with ESMTP id kB16Z5Xr016734 for ; Fri, 1 Dec 2006 08:35:13 +0200 From: "Pascal Tufenkji" To: Subject: retrieve row number Date: Fri, 1 Dec 2006 08:31:41 +0200 Message-ID: <000301c71512$5f773130$ef64a8c0@pascolo> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0004_01C71523.23000130" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 Thread-Index: AccVElxYyiHM44rURWGvDYl7CZKxuw== X-USJ-MailScanner-Information: Please contact the ISP for more information X-USJ-MailScanner: Found to be clean X-USJ-MailScanner-From: ptufenkji@usj.edu.lb X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/1 X-Sequence-Number: 26957 This is a multi-part message in MIME format. ------=_NextPart_000_0004_01C71523.23000130 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_0004_01C71523.23000130 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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

------=_NextPart_000_0004_01C71523.23000130--