oracle exists替代in

oracle in查询最多支持1000条数据,exists的使用方法需要内外关联一下才好用

select  t.eqid  from as_incentory_list  t
where t.eqid in ('aaa','bbb','ccc','ddd');

用exists的查询结果替代in括号里的集合数据,in的数据为mybatis循环赋值所得

select   t.eqid   from   as_incentory_list t   where t.id=#{id}   
exists(select   t1.eqid  from  as_inventory_temp t1   where t1.id=#{id}  and  t.eqid=t1.eqid)
  

你可能感兴趣的:(Database)