Using a Union Query - Unique Coloumns from individual tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to select unique coloumns from individual tables while using a
Union Query.
 
Not sure what you mean. All columns are unique to the table you are
selecting them from. A Union simply presents them 1 table after another . .


Could you expand on the tables that will act as the source for the union,
and what it is you are looking for when you say "Unique"
 
hey john
i have about 30 tables i need data from!
4 coloumns that are the same in all them
name, date, time, id
So my union query will retrieve these 4 coloums great

But what i also want to do is get 5 different coloumns from table 1 that do
not exist in table 2.
I am getting an error that reads "the number of columns in the two selected
tables of a union query do not match"
Is there a command or way to get around this?
I need these extra fields.
Let me know if you understand
thanks
 
Add NULL to your select statement for the columns that are missing in
Table2.

SELECT Col1, Col2, Col3, Col4, Col5, Col6, Col7
FROM Table1
UNION
SELECT Col1, Col2, Col3, Col4, Null, Null, Null
From Table2;
 
Back
Top