在sql(oracle)中动态包含条件

技术员

我有如下查询

select --------
from table a
left outer join ....c
where 
(a.column='123') and (c.column='456')

我想要

仅当(c.column ='456')不为null时才包括“(c.column ='456')”

如何在单个查询中做到这一点?还是我需要编写两个单独的查询?

我尝试了(a.column ='123')和(c.column为null),没有用

克里斯汀·马克

尝试:

select --------
from table a
left outer join ....c
where 
((a.column='123') and (c.column='456'))
or c.column is not NULL

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章