from what I understand, every SELECT statement in UNION should have the same number of columns. Columns must also have similar data types. In addition, the columns in each SELECT statement must be in the same order. "Well, if the first SELECT has more columns than the second that can generate. Here is what I mean: suppose I want
SELECT "City", "Country", "Continent" from table1
UNION
SELECT "City", "Country" from table2
... let's say that table 2 does not contain a column called "Continent", but for my needs it is good for the records that come from table2 to be empty or NULL in this column. I am using dashDB.
source
share