Question : JET SQL - Merging fields from two tables into one, skipping duplicates

I have two tables, A and B.
A has two fields, KEY_A and VAL_A.
B has two fields, KEY_B and VAL_B.
Values in KEY_A and KEY_B may overlap.

I want to select all records from A and B into a new table, C with Fields KEY_C and VAL_C.  This means I need to combine the values of KEY_A and KEY_B into one field (KEY_C), weeding out the duplicates.  How can I do this?

Mike

Answer : JET SQL - Merging fields from two tables into one, skipping duplicates

You can also try add "Group By" in order to remove duplicate entries on table A and B, like:

Insert into C (KEY_C, VAL_C) select KEY_A, VAL_A from A Group By KEY_A, VAL_A;

Insert into C (KEY_C, VAL_C) select KEY_B, VAL_B from B Where KEY_B NOT IN (Select KEY_C From C Group By  KEY_C) Group By KEY_B, VAL_B;
Random Solutions  
 
programming4us programming4us