where 中 使用 case when语句的问题
秋天之落叶 2019-12-25 12:42:46 select ... from 表1 a,表2 b
where a.中心=b.中心 and a.分组=b.分组 and a.类别=b.细项
and (case when b.分组 ='' or b.分组 is null then b.分组 else a.分组 end)= b.分组
and (case when b.姓名 ='' or b.姓名 is null then b.姓名 else a.姓名 end) =b.姓名
group by ...
请教一下, b.姓名 字段有 '' 有 NULL,单独在b表中使用 where 姓名 ='' or 姓名 is null条件有效,结果正确;单独case when b.姓名 =''或单独case when b.姓名 is null也成立,结果正确;就是 (case when b.姓名 ='' or b.姓名 is null then b.姓名 else a.姓名 end) =b.姓名使用时,总是漏掉NULL的值,这是什么原因?
如果是因为 NULL=b.姓名 造成的,因该怎么修改一下?