(注意:) 我需要in的不是一个表,而是一系列具体的值。
如果是子查询,我们一般可以这样做:
select * from table1 where id in (select id1 from table2)
select * from table1 where exists (select 1 from table2 where id1=id)
现在是具体的值如:
array[] arr = [1,2,3];
select * from table1 where id in (arr);
这种情况如何可以使用exits,毕竟如果数组元素多的话,效率还是差很远,求解?