Re: Just 1 in a series...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark Fenbers <Mark(dot)Fenbers(at)noaa(dot)gov>
Cc: PostgreSQL - SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Just 1 in a series...
Date: 2005-12-02 17:20:30
Message-ID: 3720.1133544030@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mark Fenbers <Mark(dot)Fenbers(at)noaa(dot)gov> 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 SELECT reference page. It's not
standard SQL though.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Fenbers 2005-12-02 17:44:27 Re: Just 1 in a series...
Previous Message Mark Fenbers 2005-12-02 17:15:29 Just 1 in a series...