Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 74567 invoked from network); 20 Jun 2006 04:35:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jun 2006 04:35:43 -0000 Received: (qmail 35565 invoked by uid 500); 20 Jun 2006 04:35:40 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 35547 invoked by uid 500); 20 Jun 2006 04:35:40 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 35535 invoked by uid 99); 20 Jun 2006 04:35:40 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 21:35:40 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,HTML_MESSAGE,MAILTO_TO_SPAM_ADDR X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [202.43.219.151] (HELO web8403.mail.in.yahoo.com) (202.43.219.151) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 19 Jun 2006 21:35:38 -0700 Received: (qmail 72713 invoked by uid 60001); 20 Jun 2006 04:35:15 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=uU2cTls+L/fPYGSb6V2f+J/X2GNYqtJf3rFOEMY8924SdVnpdL8ERra5kR7T/gq5upMz+LOuPGnRE9LzT2ZDTO22vNTgAs4LbTTp0EM6eo/F4RNhVtS3WE//ZZSTAOzxBcbIBW6p+5NJZ1gPg7Om7spSQARqd95SRgb/zNzZLjk= ; Message-ID: <20060620043515.72711.qmail@web8403.mail.in.yahoo.com> Received: from [210.211.198.104] by web8403.mail.in.yahoo.com via HTTP; Tue, 20 Jun 2006 05:35:15 BST Date: Tue, 20 Jun 2006 05:35:15 +0100 (BST) From: puneet arya Subject: Re: IN (SQL), how to iterate? To: user-java@ibatis.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1046905871-1150778115=:52046" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --0-1046905871-1150778115=:52046 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit ok i didnt try iterate tag . may be it works more better . Puneet arya Jeff Butler wrote: This could work, but it's not the best way to do it. You loose all the type capabilities of iBATIS and some types are not so easy to convert to strings. It's much better to use the tag. Jeff Butler On 6/15/06, puneet arya wrote: 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 #ids[]# 2006/6/15, xianwinwin : 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 --------------------------------- 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 --------------------------------- 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 --0-1046905871-1150778115=:52046 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
ok i didnt try iterate tag . may be it works more better .
                                                                Puneet arya

Jeff Butler <jeffgbutler@gmail.com> wrote:
This could work, but it's not the best way to do it.  You loose all the type capabilities of iBATIS and some types are not so easy to convert to strings.  It's much better to use the <iterate> tag.
 
Jeff Butler

 
On 6/15/06, puneet arya <puneet_arya_old@yahoo.co.in> wrote:
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



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


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 --0-1046905871-1150778115=:52046--