Rod Taylor <rbt@rbt.ca> writes:
> Oh yeah, sorry. It needs to be like that because otherwise it is unsure
> what value to use for event. What you really want is a min function
> that runs a min on date, and returns the appropriate event -- which
> doesn't exist, but I believe could be created
SELECT DISTINCT ON might provide a simpler solution to that requirement.
Check out the "weather reports" example in the SELECT reference page.
regards, tom lane