Re: difference when using 'distinct on' - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: difference when using 'distinct on'
Date
Msg-id 20030912160714.GA5956@wolff.to
Whole thread Raw
In response to difference when using 'distinct on'  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
List pgsql-general
On Fri, Sep 12, 2003 at 09:29:39 -0400,
  "Johnson, Shaunn" <SJohnson6@bcbsm.com> wrote:
>
> In the first example, is it just getting
> the unique rows for the first two columns?

Yes. Normally you would use distinct on in combination with an order by
so that you get the particular unique row you are interested in.
For example if col1 and col2 were an event type and col3 was a timestamp
for the event, you could use distinct on to get the earliest or latest
timestamp for each event type.

pgsql-general by date:

Previous
From: Andrew Rawnsley
Date:
Subject: Re: State of Beta 2
Next
From: Manfred Koizar
Date:
Subject: Re: State of Beta 2