distinct on

From: jo <jose.soares_at_sferacarta.com>
Date: Thu, 18 Oct 2012 08:38:22 +0200
Message-ID: <507FA3DE.9030407_at_sferacarta.com>



I found an interesting non standard feature in postgres to distinguish one column in a query.
How can I do this in Oracle?

select * from test;
 a | b
----+-----

 a  | b
 a  | bb
 a  | bbb
 ab | bbb
 aa | bbb
 aa | bbb
 aa | bbb

(7 rows)

select distinct * from test;
 a | b
----+-----

 a  | bb
 ab | bbb
 a  | bbb
 aa | bbb
 a  | b

(5 rows)

select distinct on(a) * from test;
 a | b
----+-----

 a  | bb
 aa | bbb
 ab | bbb

(3 rows)

j                                  

-

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 18 2012 - 08:38:22 CEST

Original text of this message