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

From Johnson, Shaunn
Subject difference when using 'distinct on'
Date
Msg-id 73309C2FDD95D11192E60008C7B1D5BB05FED833@snt452.corp.bcbsm.com
Whole thread Raw
Responses Re: difference when using 'distinct on'  (Bruno Wolff III <bruno@wolff.to>)
Re: difference when using 'distinct on'  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List 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

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Between(Interval of two dates) in Postgres
Next
From: Bruce Momjian
Date:
Subject: Re: psql prompt