Make a List of states (or an array) and use the iterate tag (see the
documentation).
Another possibility is to use
<isNotNull prepend="AND" property="state">
LG.state IN ?state?
</isNotNull>
But I don't recommend this in your case. You should really use the
iterate tag.
Christian
-----Original Message-----
From: xianwinwin [mailto:[EMAIL PROTECTED]
Sent: Monday, 16 April 2007 17:26
To: [email protected]
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
message.
query: ..... AND LG.state IN ('ny', 'bj') (in plain sql)
in ibatis:
<isNotNull prepend="AND" property="state">
LG.state IN #state:VARCHAR#
</isNotNull>
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
near
''(\'ny\', \'nj\')'
the state value is: "('ny', 'nj')"
thanks
--
View this message in context:
http://www.nabble.com/what-is-the-correct-SQL-for-IN---tf3587326.html#a1
0024994
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.