queries union

  • Thread starter Thread starter jenny
  • Start date Start date
J

jenny

Hi,

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

Thank,
Jenny
 
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).
 
Back
Top