title: Full join multiple tables on same columns
body: <p>I have four tables:</p>
  
  <pre><code>╔═══╦════╗ ╔═══╦════╗ ╔═══╦════╗ ╔═══╦════╗
  ║ K ║ V1 ║ ║ K ║ V2 ║ ║ K ║ V3 ║ ║ K ║ V4 ║
  ╠═══╬════╣ ╠═══╬════╣ ╠═══╬════╣ ╠═══╬════╣
  ║ A ║  1 ║ ║ B ║  2 ║ ║ B ║  3 ║ ║ C ║  6 ║
  ║ C ║  4 ║ ║ D ║  7 ║ ║ C ║  5 ║ ║ D ║  8 ║
  ╚═══╩════╝ ╚═══╩════╝ ╚═══╩════╝ ╚═══╩════╝
  </code></pre>
  
  <p>I need to join them by the column K and select V1, V2, V3 and V4:</p>
  
  <pre><code>╔═══╦══════╦══════╦══════╦══════╗
  ║ K ║  V1  ║  V2  ║  V3  ║  V4  ║
  ╠═══╬══════╬══════╬══════╬══════╣
  ║ A ║ 1    ║ NULL ║ NULL ║ NULL ║
  ║ B ║ NULL ║ 2    ║ 3    ║ NULL ║
  ║ C ║ 4    ║ NULL ║ 5    ║ 6    ║
  ║ D ║ NULL ║ 7    ║ NULL ║ 8    ║
  ╚═══╩══════╩══════╩══════╩══════╝
  </code></pre>
  
  <p>One way to solve it is this:</p>
  
  <pre><code>DECLARE @T1 TABLE (K VARCHAR(1), V1 INT);
  DECLARE @T2 TABLE (K VARCHAR(1), V2 INT);
  DECLARE @T3 TABLE (K VARCHAR(1), V3 INT);
  DECLARE @T4 TABLE (K VARCHAR(1), V4 INT);
  
  INSERT INTO @T1 VALUES ('A', 1), ('C', 4);
  INSERT INTO @T2 VALUES ('B', 2), ('D', 7);
  INSERT INTO @T3 VALUES ('B', 3), ('C', 5);
  INSERT INTO @T4 VALUES ('C', 6), ('D', 8);
  
  SELECT COALESCE(t1.K, t2.K, t3.K, t4.K) [K], V1, V2, V3, V4
  FROM @T1 t1
  FULL JOIN @T2 t2 ON t2.K = t1.K
  FULL JOIN @T3 t3 ON t3.K = t1.K OR t3.K = t2.K
  FULL JOIN @T4 t4 ON t4.K = t1.K OR t4.K = t2.K OR t4.K = t3.K
  ORDER BY 1;
  </code></pre>
  
  <p>But this works well only for this simple example, if I have more Ks (join conditions) and Vs, the join conditions end up being a lot more complex.</p>
  
  <p>How can this query be improved?</p>