View Full Version : Union query with different amount of columns


richmoijn
01-16-2008, 09:41 AM
Hi,

I have 2 tables, one "new" and the other one called "old".

The thing is that the "new" one has more information (more columns) than the "old". So I can only do a Union query on the columns that do match, but it is possible to have the information from the columns in the "new" table added as well into that query?

Do I have to create the new columns in the "old" table before the Union query?

BR

pbaldy
01-16-2008, 09:48 AM
You don't have to create columns in the table, but you can (have to) in the query:

SELECT Field1, Field2, Field3
FROM NewTable
UNION
SELECT Field1, Field2, "Nothing"
FROM OldTable

You can use a string, zero, or whatever is appropriate.