When you create a union query, do both queries have to be exactly the same fields?
I have one query that has 10 fields and the other 5. Can I create a union with those?
When you create a union query, do both queries have to be exactly the same fields?
I have one query that has 10 fields and the other 5. Can I create a union with those?
The columns have to match, but you can fudge the situation by simply adding 5 more columns to the smaller query: "Null as fieldname, Null as fieldname", etc.
The purpose of a union query is to combine 2 or more tables with the same exact table structure into a single structure. I agree with all of the friends. Therefore, logically, the number of columns and data types should also be the same. Finally, data duplicated in the union query is not shown in the result. If you want to show, Union All should be written instead of Union.