Search Postgresql Archives

Re: query question really cant give a summary here so read the body ;-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This works in oracle:
 
SELECT aid, bid
FROM aidbid
WHERE aid < bid
UNION
SELECT bid, aid
FROM aidbid
WHERE bid < aid


Rhys Stewart <rhys.stewart@xxxxxxxxx> wrote:
Hi all,

have the following table

aid    | bid
--------------
1    |5
2    |6
3    |7
4    |9
5    |1
6    |2
7    |3
8    |10
9    |4
10  |8
both aid & bid represent the same data in another table, but the table has duplicate data and i did a self-join to get the id's out. The question is how do i get a distinct listing between both columns

like
aid | bid
-----------
1|5
2|6
3|7
4|9
10|8

Have been racking my brain for the past hour....any suggestions?

Thanks
Rhys


Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux