RE: SQL question

  • From: Freeman Robert - IL <FREEMANR@xxxxxxxx>
  • To: 'Jesper Haure Norrevang ' <jhn.aida@xxxxxx>
  • Date: Fri, 3 Dec 2004 11:18:00 -0600

I like this solution, very nice.

RF


-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx
To: geraldine_2@xxxxxxxxxxx
Cc: oracle-l@xxxxxxxxxxxxx
Sent: 12/3/2004 11:07 AM
Subject: Re: SQL question

Geraldine,

select a, b
from mytable
where a <= b
union
select b, a
from mytable
where b = a

In Set Theory the set (1, 2) is equal to (2, 1).

Relational databases are (more and less) good implementations of Set
Theory. Basicly you are asking for a Set of Sets. Quite interesting. May
be Lex has some comments on this?

Regards
Jesper Haure


----- Original Message -----
From: geraldine_2@xxxxxxxxxxx
Date: Friday, December 3, 2004 5:37 pm
Subject: SQL question

> 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
> --
> //www.freelists.org/webpage/oracle-l
> 

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

Other related posts: