Please help me write a query

Поиск
Список
Период
Сортировка
От Nikolas Everett
Тема Please help me write a query
Дата
Msg-id AANLkTiluFJrwm29jg2TaJZFZnuUwVtris73kYpw_I_HO@mail.gmail.com
обсуждение исходный текст
Ответы Re: Please help me write a query  (Ozz Nixon <ozznixon@gmail.com>)
Re: Please help me write a query  (Justin Graf <justin@magwerks.com>)
Список pgsql-general
Say I have a table that stores state transitions over time like so:
id, transitionable_id, state1, state2, timestamp

I'm trying to write a query that coalesces changes in state2 away to produce just a list of transitions of state1.  I guess it would look something like

SELECT state1, FIRST(timestamp)
FROM table

but I have no idea how to aggregate just the repeated state1 rows.

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

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: 110,000,000 rows
Следующее
От: Ozz Nixon
Дата:
Сообщение: Re: Please help me write a query