ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From puneet arya <puneet_arya_...@yahoo.co.in>
Subject Re: IN (SQL), how to iterate?
Date Fri, 16 Jun 2006 04:33:23 GMT
hi,
   SELECT name,branch,username
               FROM KXAccount
               WHERE id IN (#ids#)
You can write in xml as 
   
     SELECT name,branch,username
               FROM KXAccount
               WHERE id IN ($ids$)
   
  and in these id you have to capture as a string . if u didnt get , you just tell me teh
full scenario i will give you the exact solution.



     eg sql: 
     
      SELECT name,branch,username
               FROM KXAccount
               WHERE id IN (#ids#)

 you can write as this:
   
   
      SELECT name,branch,username
               FROM KXAccount
     <iterate prepend="where" property="ids"open=" id in (" conjunction="," close=")" >
    #ids[]#
   </iterate>

 
  2006/6/15, xianwinwin <xianwinwin@gmail.com>:   
can anyone provide an exmple of how to use this statement with iBatis?

       SELECT name,branch,username 
       FROM KXAccount
       WHERE id IN ('234','655','411','775,'416')

the problem is in the IN clause: when I try this:

               SELECT name,branch,username
               FROM KXAccount
               WHERE id IN (#ids#)

I try this and while popuplating the #ids# with a string of:
'234','655','411','775,'416'
the result applies only to the first item (234).

does anyone know any exmple of IN which iterate through the object? 
thanks


--
View this message in context: http://www.nabble.com/IN-%28SQL%29%2C-how-to-iterate--t1789058.html#a4874196

Sent from the iBATIS - User - Java forum at Nabble.com.





-- 
RenZenggang
Renzenggang@gmail.com 
Renzenggang@csii.com
MSN:rzg117@hotmail.com
Blog: http://rzg.itpub.net


 Send instant messages to your online friends http://in.messenger.yahoo.com 

 Stay connected with your friends even when away from PC.  Link: http://in.mobile.yahoo.com/new/messenger/
 
 				
---------------------------------
  Yahoo! India Answers: Share what you know. Learn something new Click here
 Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now
Mime
View raw message