我有一个查询如下
select --------
from table a
left outer join ....c
where
(a.column='123') and (c.column='456')
我想
仅当 (c.column='456') 不为空时才包含 "(c.column='456')"
我如何在单个查询中做到这一点?还是我需要编写两个单独的查询?
我试过 (a.column='123') 和 (c.column is null),没用
尝试:
select --------
from table a
left outer join ....c
where
((a.column='123') and (c.column='456'))
or c.column is not NULL
尝试将检查 null 和值 456 放在同一组括号中:
select --------
from table a
left outer join ....c
where
(a.column='123') and (c.column is not null and c.column='456')