Parece que você precisa de
FULL OUTER JOIN
e excluir parte comum. Você pode simular com:SELECT T1.col_name
FROM T1
LEFT JOIN T2
ON T1.col_name = T2.col_name
WHERE T2.col_name IS NULL
UNION
SELECT T2.col_name
FROM T2
LEFT JOIN T1
ON T1.col_name = T2.col_name
WHERE T1.col_name IS NULL;
SqlFiddleDemo
╔══════════╗
║ col_name ║
╠══════════╣
║ C ║
║ D ║
║ E ║
║ F ║
║ G ║
╚══════════╝
Mais informações:Representação visual de junções SQL
SELECT <select_list>
FROM Table_A A
FULL OUTER JOIN Table_B B
ON A.Key = B.Key
WHERE A.Key IS NULL OR B.Key IS NULL
Infelizmente
MySQL
não suporta FULL OUTER JOIN
então eu usei união de 2 LEFT JOIN
. Adendo
Você pode expandi-lo facilmente com colunas adicionais.
SELECT 'T1' AS tab_name, T1.col_name, T1.col1, NULL AS col2
FROM T1
LEFT JOIN T2
ON T1.col_name= T2.col_name
WHERE T2.col_name IS NULL
UNION
SELECT 'T2' AS tab_name, T2.col_name, NULL, T2.col2
FROM T2
LEFT JOIN T1
ON T1.col_name= T2.col_name
WHERE T1.col_name IS NULL;
LiveDemo
Resultado:
╔══════════╦══════════╦══════╦═════════════════════╗
║ tab_name ║ col_name ║ col1 ║ col2 ║
╠══════════╬══════════╬══════╬═════════════════════╣
║ T1 ║ C ║ 3 ║ ║
║ T1 ║ D ║ 4 ║ ║
║ T2 ║ E ║ ║ 2016-01-03 00:00:00 ║
║ T2 ║ F ║ ║ 2016-01-02 00:00:00 ║
║ T2 ║ G ║ ║ 2016-01-01 00:00:00 ║
╚══════════╩══════════╩══════╩═════════════════════╝