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!

select unique values from multiple tables

Status
Not open for further replies.
Sep 25, 2002
159
US
Hi everyone,

I am working in MS Access. I have 5 tables that each have a column called 'entry_date'. I need to select the unique values from all 5 tables and insert into a new table. I know about UNION, but that seems to only be able to help me on no more than two tables...Is there anything else I can use to do this?
 
Something like this ?
INSERT INTO newTable (entry_date)
SELECT entry_date FROM (
SELECT entry_date FROM Table1
UNION SELECT entry_date FROM Table2
UNION SELECT entry_date FROM Table3
UNION SELECT entry_date FROM Table4
UNION SELECT entry_date FROM Table5
) AS U

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Isn't

INSERT INTO newTable (entry_date)
SELECT entry_date FROM Table1
UNION
SELECT entry_date FROM Table2
UNION
SELECT entry_date FROM Table3
UNION
SELECT entry_date FROM Table4
UNION
SELECT entry_date FROM Table5

working?
 
Yes it is, I had some typos in my statement, thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top