Re: UNION and ORDER BY clause

From: Kjetil Skotheim <kjetilskotheim_at_iname.com>
Date: Thu, 09 Nov 2000 17:05:48 +0100
Message-ID: <3A0AD96C.EF38EBE6_at_iname.com>


Well, UNION should not return duplicates. And ORDER BY should sort the whole thing as you want. Not? Then you could try something like: (if you are using oracle8 that is)

select distinct * from (Select1 union Select2);

 or

select distinct * from (Select1 union Select2) order by ...;

Details on UNION:
http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/server.817/a85397/operator.htm#1029587

shaikh74_at_my-deja.com wrote:
>
> Dear Oracle gurus:
>
> I have two SQL statements which are run through UNION and UNION ALL,
> and the results are exact same. They contain duplicate rows (rows
> which are in common within two SQLs). I would like to get distinct
> rows in the final result set. Also, in the final set I would them to
> run through ORDER BY clause. Your assistance values a million.
> Thanks a bunch. Please reply to shaikh74_at_visto.com
> Asad
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
 

-- 
Kjetil Skotheim
kjetilskotheim_at_iname.com
Received on Thu Nov 09 2000 - 17:05:48 CET

Original text of this message