ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jozef Hribik <jozef.hri...@apsoft.sk>
Subject Re: How to use SQL's "IN" with iBatis
Date Thu, 26 Jan 2006 08:42:25 GMT
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
>
>
>
>  
>


Mime
View raw message