difference when using 'distinct on'

From: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
To: "pg-general (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: difference when using 'distinct on'
Date: 2003-09-12 13:29:39
Message-ID: 73309C2FDD95D11192E60008C7B1D5BB05FED833@snt452.corp.bcbsm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Howdy:

Can someone tell what the difference (and why
you would use it) is between the following:

[snip]
select distinct on (col_1, col_2),
col_1,
col_2,
col_3
from t_table

--

select distinct
col_1,
col_2,
col_3
from t_table
[/snip]

In the first example, is it just getting
the unique rows for the first two columns?

Thanks!

-X

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-09-12 13:33:05 Re: psql prompt
Previous Message Pavel Stehule 2003-09-12 12:42:22 Re: Between(Interval of two dates) in Postgres