1. 程式人生 > 其它 >Mysql 用Not In 的問題:子查詢的結果中有Null則查不出來

Mysql 用Not In 的問題:子查詢的結果中有Null則查不出來

技術標籤:資料庫

Mysql 用Not In 的問題:子查詢的結果中有Null則查不出來。

這個時候要有子查詢中加條件is not null

select * from A where a.code not in (select DISTINCT B.code from B where B.code is not null) ;