pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Fenbers <Mark.Fenbers@noaa.gov>
Cc: PostgreSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: Just 1 in a series...
Date: Fri, 02 Dec 2005 12:20:30 -0500
Message-ID: <3720.1133544030@sss.pgh.pa.us> (raw)
In-Reply-To: <43908131.9060403@noaa.gov>
References: <43908131.9060403@noaa.gov>

Mark Fenbers <Mark.Fenbers@noaa.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



view thread (4+ messages)  latest in thread

Message-ID: <3720.1133544030@sss.pgh.pa.us>
Permalink:  ../3720.1133544030@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3720.1133544030@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Mark.Fenbers@noaa.gov
  Subject: Re: Just 1 in a series...
  In-Reply-To: <3720.1133544030@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox