Hi, I need help with procedure to create union query to combine datas in 2 tables.
I'm not doing any projects as such just learning it...
I have googled and found that union query can do it.
So please help.
Thanks
pedie:
Your information is a little sparse but essentially you can do this:
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere
From Table1NameHere
Union
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere
From Table2NameHere
if you want all records even if they are duplicated you would use UNION ALL
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere
From Table1NameHere
UNION ALL
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere
From Table2NameHere
And you can add information like if you wanted to know which table it came from:
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere, "Table1" As MySource
From Table1NameHere
UNION
Select Field1NameHere, Field2NameHere, Field3NameHere, Field4NameHere, "Table2" As MySource
From Table2NameHere
So I hope that gets you started anyway.