I have a sql statement that is a union of several queries which all just return keys:
SELECT DISTINCT key as KEY FROM tablea WHERE XYZ
UNION ALL
SELECT DISTINCT id as KEY FROM tableb WHERE XYZ
UNION ALL
...
My question is that there are some queries that return keys that overlap, and I actually want the final KEY field returned values to be distinct values. Any ideas?