E eugz Registered User. Local time Today, 17:36 Joined Aug 31, 2004 Messages 128 Aug 24, 2007 #1 Hi All. Need union three TableA, TableB and TableC into one table called TableX? All table has same column name. TableX shouldn't has dublications. Thanks
Hi All. Need union three TableA, TableB and TableC into one table called TableX? All table has same column name. TableX shouldn't has dublications. Thanks
M Moniker VBA Pro Local time Today, 16:36 Joined Dec 21, 2006 Messages 1,567 Aug 24, 2007 #2 First query (call it something obvious -- I'll use q_Union_Tables) Code: SELECT Field1, Field2, FieldX FROM TableA UNION SELECT Field1, Field2, FieldX FROM TableB UNION SELECT Field1, Field2, FieldX FROM TableC; Second query (this is a make table query where we will make TableX): Code: SELECT DISTINCT Field1, Field2, FieldX INTO TableX FROM q_Union_Tables; The distinct will only write unique values to TableX.
First query (call it something obvious -- I'll use q_Union_Tables) Code: SELECT Field1, Field2, FieldX FROM TableA UNION SELECT Field1, Field2, FieldX FROM TableB UNION SELECT Field1, Field2, FieldX FROM TableC; Second query (this is a make table query where we will make TableX): Code: SELECT DISTINCT Field1, Field2, FieldX INTO TableX FROM q_Union_Tables; The distinct will only write unique values to TableX.