|
Question : Join unrelated tables
|
|
Hi,
I have two tables that are technically unrelated but I would like them all returned together in one big query.
Obviously if I try and do a normal SQL statement combining the two it results in a cartesian join.
I can't use Union as the return columns differ between the tables.
I am quite happy with NULL's in the columns where that table doesnt have that data.
Is this possible?
Thanks.
James.
|
|
Answer : Join unrelated tables
|
|
you can do it with a union but you need some placeholder columns
eg:
table1 as col1 and table2 has col2
SELECT col1,NULL from table1 UNION ALL SELECT NULL,col2 from table2
|
|
|