Re: enumerating rows

From: "Poul L(dot) Christiansen" <poulc(at)cs(dot)auc(dot)dk>
To: Kovacs Zoltan <kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: enumerating rows
Date: 2001-04-11 13:29:39
Message-ID: Pine.GSO.4.21.0104111526560.17444-100000@borg.cs.auc.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Use the "serial" column type.

create table myTable (row_no serial,column1 varchar(10),column2
varchar(20));

HTH,
Poul L. Christiansen

On Wed, 11 Apr 2001, Kovacs Zoltan wrote:

> Maybe a trivial question, maybe it's foreign from SQL, I'dont know...
> How to add a column which stands for the row number in each row of the
> result? E.g.:
>
> row_no | column1 | column2 | ...
> -------+---------+---------+ ...
> 1 | datum11 | datum12 | ...
> 2 | datum21 | datum22 | ...
> ... | ... | ... | ...
>
> I didn't find anything in the docs.
>
> TIA, Zoltan
>
> --
> Kov\'acs, Zolt\'an
> kovacsz(at)pc10(dot)radnoti-szeged(dot)sulinet(dot)hu
> http://www.math.u-szeged.hu/~kovzol
> ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kovacs Zoltan 2001-04-11 14:37:20 Re: enumerating rows
Previous Message cbell 2001-04-11 13:05:53 Re: Re: \i command