ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: what is the correct SQL for IN ?
Date Mon, 16 Apr 2007 22:12:51 GMT
Make a List of states (or an array) and use the iterate tag (see the

Another possibility is to use
	  <isNotNull prepend="AND" property="state">
	  	LG.state IN ?state?
But I don't recommend this in your case. You should really use the
iterate tag.


-----Original Message-----
From: xianwinwin [mailto:xianwinwin@gmail.com] 
Sent: Monday, 16 April 2007 17:26
To: user-java@ibatis.apache.org
Subject: what is the correct SQL for IN ?

Hi there,

I wonder how to implement this query in ibatis as it gives me an error

query: ..... AND LG.state IN ('ny', 'bj')   (in plain sql) 

in ibatis: 

	  <isNotNull prepend="AND" property="state">
	  	LG.state IN #state:VARCHAR#

error:  You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
''(\'ny\', \'nj\')' 	   	

the state value is: "('ny', 'nj')" 

View this message in context:
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

View raw message