我认为CASE
声明在连接条件下工作,但我不确定.但这对你有用吗?
select * from table1 a where a.cola1 = 'valuea1' or (a.cola1 = 'valuea2' and Exists(select 1 from table2 b where a.cola2 = b.colb2 and b.colb3 = 'valueb3' ) )
编辑:这不会简单地工作吗?
select a.* from table1 a Left Outer Join table2 b On (a.cola2 = b.colb2) where a.cola1 = 'valuea1' or (a.cola1 = 'valuea2' and b.colb3 = 'valueb3')