我有如下数据
ID Status W_ID
1 In Progress 7
2 In Progress 5
3 Complete 5
4 In Progress NULL
5 Complete 7
我想要选择状态为“进行中”且 W_ID 为 NULL 或 W_ID 为 5 的记录
结果就像
ID Status W_ID
2 In Progress 5
4 In Progress NULL
我应该如何编写选择查询?
WHERE Status = 'In Progress' AND (W_ID IS NULL OR W_ID = 5)
或者
WHERE Status = 'In Progress' AND ISNULL(W_ID,5)= 5
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句