You might need to do something like this where the property keys is an
array, not sure though, never having tried it myself.

select table.colum1 from table where table.colum2 IN
<iterate conjunction="or" property="keys" open="(" close=")"/>

Cheers,
Kev

-----Original Message-----
From: anson [mailto:[EMAIL PROTECTED] 
Sent: 26 January 2006 08:37
To: [email protected]
Subject: How to use SQL's "IN" with iBatis 

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!!





Reply via email to