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: SQL question

RE: SQL question

From: Kevin Lange <klange_at_ppoone.com>
Date: Fri, 3 Dec 2004 11:03:10 -0600
Message-ID: <ED1256BD4F253C44B1627B2D365A334F087660EE@ppoone1.ppoone.com>


make it a distinct select and it works.

-----Original Message-----

From: Stephane Faroult [mailto:sfaroult_at_roughsea.com] Sent: Friday, December 03, 2004 11:10 AM To: oracle-l_at_freelists.org; geraldine_2_at_comcast.net Subject: Re: SQL question  

select least(a, b) a,

           greatest(a, b) b

from my_table

where least(a, b) <= greatest(a, b)

Assuming of course that the table isn't in the multi-million range.

Regards,

Stephane Faroult

RoughSea Ltd
http://www.roughsea.com

On Fri, 03 Dec 2004 16:37 , geraldine_2_at_comcast.net sent:

Hi,
I have the following table below

SQL> select * FRom mytable;
A B
---------- ----------

1 2
3 4
2 1
5 6
4 3

5 rows selected.

and I like to get the following output:

A B
---------- ----------

1 2
3 4
5 6

basically (1,2) is the same as (2,1) and I would just like to display any of those combination just once.

Not sure how I can write a SQL to extract the data. Can someone help.

TIA. Geraldine
--

http://www.freelists.org/webpage/oracle-l[1]

--

http://www.freelists.org/webpage/oracle-l
--

http://www.freelists.org/webpage/oracle-l Received on Fri Dec 03 2004 - 11:01:14 CST

Original text of this message

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