pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pascal Tufenkji <ptufenkji@usj.edu.lb>
To: pgsql-sql@postgresql.org
Subject: retrieve row number
Date: Fri, 1 Dec 2006 08:31:41 +0200
Message-ID: <000301c71512$5f773130$ef64a8c0@pascolo> (raw)

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

view thread (2+ messages)  latest in thread

Message-ID: <000301c71512$5f773130$ef64a8c0@pascolo>
Permalink:  ../000301c71512$5f773130$ef64a8c0@pascolo/
Also on:    postgresql.org/message-id/000301c71512$5f773130$ef64a8c0@pascolo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ptufenkji@usj.edu.lb
  Subject: Re: retrieve row number
  In-Reply-To: <000301c71512$5f773130$ef64a8c0@pascolo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox