| От | Elrich Marx |
|---|---|
| Тема | Flatten table using timestamp and source |
| Дата | |
| Msg-id | 73a6b75b83b37093e5e2751fc59c4323@mail.gmail.com обсуждение |
| Ответы |
Re: Flatten table using timestamp and source
|
| Список | pgsql-sql |
Good day.
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.
Any suggestions would be much appreciated.
Regards
El
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера