Re: returning row numbers in select

From: Chris <list(at)1006(dot)org>
To: Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: returning row numbers in select
Date: 2004-03-10 21:08:25
Message-ID: 1078952905.6547.66.camel@dell
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> I to return a sequential row number beginning at 1?
>
> i.e.
>
> row| timestamp
> ---+----------------------------
> 1 2004-02-01 23:15:00.824-05
> 2 2004-02-01 23:15:01.824-05
> 3 2004-02-01 23:15:02.824-05
> ...
>
> My reason for wanting row numbers is so I can use a 'MOD(row_number,
> n)' to get the nth row from the table.

Doesn't LIMIT and OFFSET do the job?
http://www.postgresql.org/docs/7.3/interactive/queries-limit.html

Bye, Chris.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randall Skelton 2004-03-10 21:23:17 Re: returning row numbers in select
Previous Message Josué Maldonado 2004-03-10 21:00:06 Organize tables in schemas