X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id BB8C29DD73D for ; Fri, 2 Dec 2005 13:20:35 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39090-02 for ; Fri, 2 Dec 2005 13:20:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 1E92A9DD743 for ; Fri, 2 Dec 2005 13:20:31 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jB2HKVCM003721; Fri, 2 Dec 2005 12:20:31 -0500 (EST) To: Mark Fenbers cc: PostgreSQL - SQL Subject: Re: Just 1 in a series... In-reply-to: <43908131.9060403@noaa.gov> References: <43908131.9060403@noaa.gov> Comments: In-reply-to Mark Fenbers message dated "Fri, 02 Dec 2005 12:15:29 -0500" Date: Fri, 02 Dec 2005 12:20:30 -0500 Message-ID: <3720.1133544030@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/7 X-Sequence-Number: 23549 Mark Fenbers 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