SQL WHERE语句?

时间:2010-10-01 10:05:34

标签: tsql

我的WHERE子句应该在SQL语句中应该返回哪些行,其中列A为空或列B为空,而不是两者都为空?

2 个答案:

答案 0 :(得分:6)

WHERE (ColA is NULL AND ColB is NOT NULL)
OR (ColB is NULL AND ColA is NOT NULL)

答案 1 :(得分:3)

(A IS NULL OR B IS NULL) AND NOT (A IS NULL AND B IS NULL)