Sample for 9421316

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physics

Q&A for active researchers, academics and students of physics

WITH a as 
(
SELECT 'A' as master , 1 ColA
UNION SELECT 'A' , 2
UNION SELECT 'B' , 1
UNION SELECT 'B' , 2),
b as (
SELECT 'A' as master , 1 ColB
UNION SELECT 'A' , 3
UNION SELECT 'B' , 1
UNION SELECT 'B' , 2
UNION SELECT 'C' , 1)

SELECT
   COALESCE(a.master,b.master) master,
   a.ColA,
   b.ColB
FROM
  a FULL OUTER JOIN B
  ON a.master = b.master
  AND (a.ColA = b.ColB 
          or a.ColA is Null
          or b.ColB is Null)
ORDER BY 
     COALESCE(a.master,b.master),
     COALESCE(a.cola,b.colB)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results