queries union

J

jenny

Hi,

Is that when I do the queries union,it will automatically
eliminate the duplicate records?

Thank,
Jenny
 
J

John Vinson

Hi,

Is that when I do the queries union,it will automatically
eliminate the duplicate records?

Thank,
Jenny

Yes:

SELECT this, that, theother
FROM TableA
UNION
SELECT x, y, z
FROM TableB

will return only those records which are unique for the three fields.

You can use

UNION ALL

if you want to see all the duplicates (and the query will run faster
as well).
 
Top