SQL full join without any conditions
sql, sql-server, t-sql
Solution
Try something like this:
SELECT *
FROM A
FULL OUTER JOIN B ON 1 = 1
FULL OUTER JOIN C ON 1 = 1
Problem
I am using MS SQL. I have the following tables: ``` table A: id1 data1 8234 ko 2 po 333 koo 40 woo table B: id2 data2 123 meow 654 frrr table C: id3 data3 10 a 20 b 30 c 40 d 50 e 60 f ``` I want to get this: ``` id1 data1 id2 data2 id3 data3 8234 ko 123 meow 10 a 2 po 654 frrr 20 b 333 koo NULL NULL 30 c 40 woo NULL NULL 40 d NULL NULL NULL NULL 50 e NULL NULL NULL NULL 60 f ``` It's seems like full sum of tables without any conditions. I just want to get all columns and all data from all tables as is. How can I do this? UPD: tables are not related. In case when tables are related: I would use LEFT or RIGHT JOIN, when it was known in advance what table is larger than. But it is unknown.