Re: returning row numbers in select
От | Randall Skelton |
---|---|
Тема | Re: returning row numbers in select |
Дата | |
Msg-id | E2662045-72E1-11D8-BD91-000393C92230@brutus.uwaterloo.ca обсуждение исходный текст |
Ответ на | Re: returning row numbers in select (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: returning row numbers in select
Re: returning row numbers in select |
Список | pgsql-general |
>> Correction, I don't want to simply get the nth row, I want all rows >> that are divisible by n. Essentially, the timestamp is at a regular >> interval and I want a way of selecting rows at different sampling >> intervals. > > Couldn't you code this as a WHERE test on the timestamp? That would be ideal as it is theoretically possible for there to be missing rows due to sampling errors; nevertheless, a WHERE test doesn't seem obvious to me. Can you please post an example? The time spacing between rows is 1 second but I want my select statement to return rows every 5 seconds (see marked lines below). I've tried various interval operations but I don't really understand how to relate the timestamp and and the interval. SELECT timestamp FROM test WHERE timestamp > '2004-02-02 04:15:00.00 +0' AND timestamp < '2004-02-02 04:15:10.00 +0' ORDER BY timestamp; timestamp ---------------------------- 2004-02-01 23:15:00.824-05 * 2004-02-01 23:15:01.824-05 2004-02-01 23:15:02.824-05 2004-02-01 23:15:03.824-05 2004-02-01 23:15:04.824-05 2004-02-01 23:15:05.824-05 * 2004-02-01 23:15:06.824-05 2004-02-01 23:15:07.824-05 2004-02-01 23:15:08.824-05 2004-02-01 23:15:09.824-05 2004-02-01 23:15:10.824-05 * ... Thanks, Randall
В списке pgsql-general по дате отправления: