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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top