Assuming dups can be deleted, here's my humble
attempt:

select col1, col2
from t
order by col1, col2;

Col1 Col2
-    -
A    B
B    A
C    D
E    F
G    H
H    G

6 rows selected.

select col1, col2
from t
union
select col2, col1
from t
;

Col1 Col2
-    -
A    B
B    A
C    D
D    C
E    F
F    E
G    H
H    G

8 rows selected.

mohammed

--- "Deshpande, Kirti" <[EMAIL PROTECTED]>
wrote:
> Hi SQL Developers, 
> 
> I have a table as follows:
> 
> Col1   Col2
> ----------------
> A        B
> C        D
> E        F
> G        H
> B        A
> E        F
> C        D
> H        G
> 
> With a PK on (Col1, Col2). 
> 
> How do I write a SQL script to get following result?
> 
> 
> Col1    Col2
> --------------------
> A        B
> B        A
> C        D
> D        C
> E        F
> F        E
> G       H
> H       G
> 
> Thanks for your help.
> 
> - Kirti 
> 
> -- 
> Please see the official ORACLE-L FAQ:
> http://www.orafaq.net
> -- 
> Author: Deshpande, Kirti
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- 858-538-5051
> http://www.fatcity.com
> San Diego, California        -- Mailing list and web
> hosting services
>
---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an
> E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of
> 'ListGuru') and in
> the message BODY, include a line containing: UNSUB
> ORACLE-L
> (or the name of mailing list you want to be removed
> from).  You may
> also send the HELP command for other information
> (like subscribing).
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: mkb
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to