You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Jozef Hribik <jo...@apsoft.sk> on 2006/01/26 09:42:25 UTC
Re: How to use SQL's "IN" with iBatis
String[] key;
select table.colum1 from table
<dynamic>
<isNotEmpty prepend="WHERE" property="key">
table.colum2
<iterate property="var1" open=" IN (" close=")" conjunction=",">
#key[]#
</iterate>
</isNotEmpty>
</dynamic>
anson wrote:
>Dears,
>
>Could any one tell me how to use "IN" with iBatis?
>
>For example:
>
>case 1:
>
>String key = "01,02,03";
>
>select table.colum1 from table where table.colum2 IN (#key#)
>
>I can not get anything.
>
>
>
>
>
>case 2:
>
>String key = "01";
>
>select table.colum1 from table where table.colum2 IN (#key#)
>
>I can get the right result.
>
>
>
>
>
>case 3:
>String key = "'01'"
>
>select table.colum1 from table where table.colum2 IN (#key#)
>
>I can not get anything.
>
>
>
>
>
>How can I get right result with iBatis like this SQL:
>
>select table.colum1 from table where table.colum2 IN ('01', '02', '03');
>
>Best Regards!!
>
>
>
>
>
>__________ Informacia od NOD32 1.1380 (20060125) __________
>
>Tato sprava bola preverena antivirusovym systemom NOD32.
>http://www.eset.sk
>
>
>
>__________ Informacia od NOD32 1.1380 (20060125) __________
>
>Tato sprava bola preverena antivirusovym systemom NOD32.
>http://www.eset.sk
>
>
>
>
>