From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: retrieve row number
Date: Fri, 1 Dec 2006 07:56:20 +0100
Message-ID: <20061201065620.GB1628@a-kretschmer.de> (raw)
In-Reply-To: <000301c71512$5f773130$ef64a8c0@pascolo>
References: <000301c71512$5f773130$ef64a8c0@pascolo>
am Fri, dem 01.12.2006, um 8:31:41 +0200 mailte Pascal Tufenkji folgendes:
> Hi,
>
>
>
> Can I retrieve the row number in a select statement?
> For example : if I have the following table ?foo?
> I should obtain the following result :
>
>
>
> row_number | col1 | col2
> -----------+------+-----
> 1 | a | x
> 2 | b | y
> 3 | c | z
test=> create temporary sequence tmp_seq;
CREATE SEQUENCE
test=*> select nextval('tmp_seq') as row_number, col1, col2 from foo;
row_number | col1 | col2
------------+------+------
1 | a | x
2 | b | y
3 | c | z
(3 rows)
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
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: andreas.kretschmer@schollglas.com
Subject: Re: retrieve row number
In-Reply-To: <20061201065620.GB1628@a-kretschmer.de>
* 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