Re: Flatten table using timestamp and source

Поиск
Список
Период
Сортировка
От Raj Mathur (राज माथुर)
Тема Re: Flatten table using timestamp and source
Дата
Msg-id 201205241729.21270.raju@linux-delhi.org
обсуждение исходный текст
Ответ на Flatten table using timestamp and source  (Elrich Marx <elrich.marx@rorotika.com>)
Ответы Re: Flatten table using timestamp and source  (Elrich Marx <elrich.marx@rorotika.com>)
Список pgsql-sql
On Thursday 24 May 2012, Elrich Marx wrote:
> I am quite new to Postgres, so please bear with me.
>
> I  have a table with data in the following format:
>
> Table name : Time_Source_Table
>
> Source , Stime
> 1, "2012-05-24 13:00:00"
> 1, "2012-05-24 13:01:00"
> 1, "2012-05-24 13:02:00"
> 2, "2012-05-24 13:03:00"
> 2, "2012-05-24 13:04:00"
> 1, "2012-05-24 13:05:00"
> 1, "2012-05-24 13:06:00"
>
> I’m trying to get to a result  that flattens the results based on
> source, to look like this:
>
> Source, Stime, Etime
> 1, "2012-05-24 13:00:00","2012-05-24 13:02:00"
> 2, "2012-05-24 13:03:00","2012-05-24 13:04:00"
> 1, "2012-05-24 13:05:00","2012-05-24 13:06:00"
>
> Where  Etime is the last Stime for the same source.

How do you figure out that the Etime for (1, 13:00:00) is (1, 13:02:00)
and not (1, 13:01:00)?

Regards,

-- Raj
--
Raj Mathur                          || raju@kandalaya.org   || GPG:
http://otheronepercent.blogspot.com || http://kandalaya.org || CC68
It is the mind that moves           || http://schizoid.in   || D17F


В списке pgsql-sql по дате отправления:

Предыдущее
От: Elrich Marx
Дата:
Сообщение: Flatten table using timestamp and source
Следующее
От: Elrich Marx
Дата:
Сообщение: Re: Flatten table using timestamp and source