Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: A SQL Question

RE: A SQL Question

From: Whittle Jerome Contr NCI <Jerome.Whittle_at_scott.af.mil>
Date: Thu, 13 Mar 2003 06:39:29 -0800
Message-ID: <F001.00568F00.20030313063929@fatcity.com>


SELECT table.Col1, table.Col2
FROM table
UNION
SELECT table.Col2, table.Col1
FROM table
ORDER BY table.Col1;

Actually you might not even need the ORDER BY....

Jerry Whittle
ASIFICS DBA
NCI Information Systems Inc.
jerome.whittle_at_scott.af.mil
618-622-4145

> -----Original Message-----
> From: Deshpande, Kirti [SMTP:kirti.deshpande_at_verizon.com]
>
> 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: Whittle Jerome Contr NCI
  INET: Jerome.Whittle_at_scott.af.mil

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: ListGuru_at_fatcity.com (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).
Received on Thu Mar 13 2003 - 08:39:29 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US