I would write this as:
len(coalesce(c.email1, e.email, org_email)) <> 0
but you probably have the same problem. So the answer to your question using case
and is null
is:
(case when c.email1 is null and e.email is null and org_email is null
then 0 -- all are missing
else 1
end) = 1
I don't like case
statements in the where
clause, so the better answer is the simpler expression:
(c.email1 is not null or e.email is not null or org_email is not null)
This is really the right way to express the logic.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…