T1 - 只有一列的表一
Bart
Philip
Beth
T2 - 只有一列的表二
Robert
Bart
Philip
Ann
Jack
Helen
Beth
JOIN 后的預期結果是:
Robert
Ann
Jack
Helen
uj5u.com熱心網友回復:
你所追求的是一個簡單的 outer join
select t2.col
from t2
left join t1 on t2.col=t1.col
where t1.col is null
您也可以將其表示為 not exists
select *
from t2
where not exists(select 1 from t1 where t2.col=t1.col)
您也可以使用 except
select *
from t2
except
select *
from t1
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/407724.html
標籤:
