ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Broderick, Kevin" <kevin.broder...@iona.com>
Subject RE: How to use SQL's "IN" with iBatis
Date Thu, 26 Jan 2006 08:53:30 GMT
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:anson@linkclub-staff.com] 
Sent: 26 January 2006 08:37
To: user-java@ibatis.apache.org
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!!






Mime
View raw message