SQL not in: in SQL queries, select * from t1 where c not in (select c2 from t2) If c2 in t2 has null, the result of this statement may be, only when the NULL value must be filtered out in the subquery can www.2cto.com select * from t1 where c not in (select c2 from t2 where c2 is not null) Be normal) the reason for searching is that the SQL-92 standard requires a value of equal to (=) or not equal to (<>) for a null value. When SET ANSI_NULLS is ON, even if column_name has a NULL value, the SELECT statement that uses WHERE column_name = NULL still returns zero rows. Even if column_name has a non-NULL value, the SELECT statement using WHERE column_name <> NULL still returns zero rows. When SET ANSI_NULLS is OFF, equal to (=) and not equal to (<>) Comparison operators do not comply with SQL-92 standards. Use the SELECT statement WHERE column_name = NULL to return the rows with NULL values in column_name. Use the WHERE column_name <> null select statement to return rows with non-NULL values in the column. In addition, use the SELECT statement WHERE column_name <> XYZ_value to return all rows with non-XYZ values and non-NULL values. Exists is also available.