我想删除表中 6 个字段的答案为零/空的行:
Delete
from TableA
WHERE (a + b + c + d + e + f) IS NULL
谢谢
WHERE COALESCE((a + b + c + d + e + f), 0) = 0
或者
WHERE NULLIF((a + b + c + d + e + f), 0) IS NULL
不需要对每一列都有这个
尝试这个
DELETE T FROM
dbo.TableA T
WHERE COALESCE(a, 0) +
COALESCE(b, 0) +
COALESCE(c, 0) +
COALESCE(d, 0) +
COALESCE(e, 0) +
COALESCE(f, 0) = 0
如果您只想删除这些行,那么您可以使用查询
DELETE FROM TableName
WHERE (a + b + c + d + e + f) IS NULL OR (a + b + c + d + e + f) = 0
我希望它会帮助你。:)
您的意思是如果所有字段为空,或者如果 1 个或多个字段为空?
它可能很简单:
delete
from TableA
WHERE (a + b + c + d + e + f) IS NULL