Re: [SQL] Just 1 in a series...

2005-12-05 Thread Patrick JACQUOT
Mark Fenbers wrote: What would have to be done if I needed a standard SQL solution? Mark ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org Maybe you could t'ry something like : Se

Re: [SQL] Just 1 in a series...

2005-12-02 Thread Mark Fenbers
You might find the "DISTINCT ON" syntax does just what you want --- see the "weather report" example on the SELECT reference page. It's not standard SQL though. This works! Thanks! What would have to be done if I needed a standard SQL solution? Mark ---(end of bro

Re: [SQL] Just 1 in a series...

2005-12-02 Thread Tom Lane
Mark Fenbers <[EMAIL PROTECTED]> writes: > ... However, I only want the first occurrence of a such a series (where the > event_id is the same), what SQL syntax should I use to do this? You might find the "DISTINCT ON" syntax does just what you want --- see the "weather report" example on the SEL

[SQL] Just 1 in a series...

2005-12-02 Thread Mark Fenbers
I currently have a working SQL that SELECTs all records whose 'river_stage' column exceeds the 'flood_stage' column. (Very simple -- no applause needed.) Typically, if I get one record, I get a consecutive series of them since rivers rise and fall in a continuous fashion, and usually respond