Column1 Column2 Column3 Column4 Column5 Column6
NULL NULL NULL NULL NULL NULL
我尝试了以下查询:
1.
Delete from tablename where column1 = NULL
2.
Delete from tablename where column1 IS NULL
第二个查询成功完成,但它说 0 行受到影响。
Column1 Column2 Column3 Column4 Column5 Column6
NULL NULL NULL NULL NULL NULL
我尝试了以下查询:
1.
Delete from tablename where column1 = NULL
2.
Delete from tablename where column1 IS NULL
第二个查询成功完成,但它说 0 行受到影响。
is null
尝试匹配空值时必须使用特殊语法:
delete from mytable
where Column1 is null
and Column2 is null
and Column3 is null
and Column4 is null
and Column5 is null
and Column6 is null;
任何常规比较null
总是错误的,
例如两者Column1 = null
和Column1 != null
总是false
我相信这对您的 rdbms 或等效项应该有效。如果 isnull 函数的返回值等于空字符串,它将删除行。
DELETE FROM tablename
WHERE isnull(Column1, '') = ''
DELETE FROM table WHERE coalesce(col1,col2,col3,...) IS NULL