returning row numbers in select
От | Randall Skelton |
---|---|
Тема | returning row numbers in select |
Дата | |
Msg-id | 03A9CA5B-72D1-11D8-BD91-000393C92230@brutus.uwaterloo.ca обсуждение исходный текст |
Ответы |
Re: returning row numbers in select
Re: returning row numbers in select |
Список | pgsql-general |
Is there a way to return an integer row number for a query? Note that there may be a large number of rows so I would rather not have joined selects... For a rather simple query: SELECT timestamp from test WHERE timestamp > '2004-02-02 04:15:00.00 +0' AND timestamp < '2004-02-02 04:15:10.00 +0'; where 'test' is Column | Type | Modifiers -----------+--------------------------+----------- timestamp | timestamp with time zone | value | double precision | Indexes: table_timestamp 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. Cheers, Randall
В списке pgsql-general по дате отправления: