Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DISTINCTROW across 2 tables?

Status
Not open for further replies.

shadedecho

Programmer
Oct 4, 2002
336
US
OK, I want to construct a SQL query that returns a result set of unique pairs of 2 fields:

table A: table B:

x y x y
___ ___ ___ ___
3 4 4 5
4 5 4 6
3 6 3 4
4 5

the result set would do a DISTINCTROW across both tables, giving me something like

x y
___ ___
3 4
4 5
3 6
4 6


Help! (If it helps, I am using MySQL 3.23, and I'd like to not have to do anything like SELECT'ing into temp tables or anything like that)... anyone know how I can accomplish this?
 
Assuming mysql supports unions the query would be

select distinct x, y from tablea
union
select distinct x, y from tableb

 
Mysql 3.23 does not support union so there is no other solution than using temporary tables.
 
Well I guess then you could get a real DBMS that actually supports a reasonable subset of Ansii SQL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top