ibatis中in的用法
select * from Table A where A.id in (XXXXXX)
后面的XXXX子语句我是通过查询另外两张表获取的数据。
应该咋写呢?
<iterate conjunction="," open="(" close=")" >
#value[]#
</iterate>
这种写法,好像都是把子语句当作参数传进去的,,不符合我的需求
[解决办法]
直接把查询语句写在后面不就行了?
select * from Table A where A.id in ( select id from Table B)
[解决办法]
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
<iterate conjunction="," open="(" close=")" >
#value[]#
</iterate>