Please help me write a query - Mailing list pgsql-general

From Nikolas Everett
Subject Please help me write a query
Date
Msg-id AANLkTiluFJrwm29jg2TaJZFZnuUwVtris73kYpw_I_HO@mail.gmail.com
Whole thread Raw
Responses Re: Please help me write a query
Re: Please help me write a query
List 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 by date:

Previous
From: Thom Brown
Date:
Subject: Re: 110,000,000 rows
Next
From: Ozz Nixon
Date:
Subject: Re: Please help me write a query