开发者

Leaving out Data based on Checking 2 fields for null

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜