开发者

Leaving out Data based on Checking 2 fields for null

开发者 https://www.devze.com 2023-03-07 23:23 出处:网络
I have a query and at the end I want to leave out records where a certain two fields contain nulls at the same time

I have a query and at the end I want to leave out records where a certain two fields contain nulls at the same time

e.g.

开发者_运维问答
and ((d.status is null AND b.actual is null)) < 1

so basically leave out the record if both of these fields have null at the same time.


I'd write this as:

...WHERE d.status IS NOT NULL OR b.actual IS NOT NULL

which, by DeMorgan's Laws, could also be written as:

...WHERE NOT(d.status IS NULL AND b.actual IS NULL)
0

精彩评论

暂无评论...
验证码 换一张
取 消