年齢、名前、職業は主キー(または少なくとも一意のキー)を形成しますか?
もしそうなら、あなたは次のようなことをすることができます:
SELECT
t1.name, t1.age, t1.profession,
t1.column1 as t1column1, t2.column1 as t2column1,
t1.column2 as t1column2, t2.column2 as t2column2,
FROM
table1 t1, table2 t2
WHERE
(t1.name = t2.name and t1.age = t2.age and t1.profession = t2.profession) and
(
t1.column1<>t2.column1
OR t1.column2<>t2.column2
OR t1.column3<>t2.column3)
もちろん、これには両方のテーブルで同じである一意のキーが必要です。また、クエリの結果を明確に変更して、変更された列だけでなくすべての列を表示するようにしました。単一のT-SQLクエリでそのように変更されたものを特定するのは厄介です(ただし可能です)ので、このように返すことをお勧めします。ユースケースに応じて、アプリケーション/プレゼンテーション層に変更された列を見つけるか、スキャンするだけです。目でそれ。
本当にT-SQLでそれを実行したい場合は、次のようにUNIONSで実行できます。
SELECT
t1.name, t1.age, t1.profession,
'column1' as ColumnChanged,
t1.column1 as oldValue,
t2.column1 as newValue
FROM
table1 t1, table2 t2
WHERE
(t1.name = t2.name and t1.age = t2.age and t1.profession = t2.profession) and
t1.column1<>t2.column1
UNION ALL #better peformance than UNION, which would enforce uniqueness
SELECT
t1.name, t1.age, t1.profession,
'column2' as ColumnChanged,
t1.column2 as oldValue,
t2.column2 as newValue
FROM
table1 t1, table2 t2
WHERE
(t1.name = t2.name and t1.age = t2.age and t1.profession = t2.profession) and
t1.column2<>t2.column2
.......