当前位置: 代码迷 >> J2EE >> ibatis中in的用法解决思路
  详细解决方案

ibatis中in的用法解决思路

热度:10289   发布时间:2013-02-25 21:39:57.0
ibatis中in的用法
select * from Table A where A.id in (XXXXXX)

后面的XXXX子语句我是通过查询另外两张表获取的数据。

应该咋写呢?

  <iterate conjunction="," open="(" close=")" >
       #value[]# 
   </iterate>  

这种写法,好像都是把子语句当作参数传进去的,,不符合我的需求
select * from tablea a where exists(select 1 from tableb b where b.id = a.id);尽量不要使用in直接把查询语句写在后面不就行了?
select * from Table A where A.id in ( select id from Table B)
引用:
select * from Table A where A.id in (XXXXXX)

后面的XXXX子语句我是通过查询另外两张表获取的数据。

应该咋写呢?

  <iterate conjunction="," open="(" close=")" >
       #value[]# 
   </iterate>  

这种写法,好像都是把子……


-难道这样写不对?

select * from Table A where A.id in 
  <iterate conjunction="," open="(" close=")" >
       #value[]# 
   </iterate>  
  相关解决方案