这个查询是否可能:
select *
from table t
where (t.key1, t.key2, t.key3) IN ('a','b','c','d')
包含多个列和多个值的条件。
答案 0 :(得分:1)
select *
from table t
where t.key1 IN ('a','b','c','d') OR
t.key2 IN ('a','b','c','d') OR
t.key3 IN ('a','b','c','d')
答案 1 :(得分:1)
您必须将其拆分为多个语句。我不知道您是要OR
还是AND
,所以我在此示例中使用了AND
:
select *
from table t
where (t.key1) IN ('a','b','c','d')
and (t.key2) IN ('a','b','c','d')
and (t.key3) IN ('a','b','c','d')
或使用join
和内联视图:
select *
from table t
join ( select 'a' col
from dual
union
select 'b'
from dual
union
select 'c'
from dual
union
select 'd'
from dual
) x
on t.key1 = x.col
and t.key2 = x.col
and t.key3 = x.col