0

I have a requirement of using IN in a query which has a format of something like:

@Select("SELECT max(count) FROM whatevertable WHERE id IN (#{xyz})")
public int doSomething(List<Integer> xyz)

I tried searching but found all kinds of functions in XML but my requirement is using JAVA. Can anyone help me with this?

Sourabh
  • 1,253
  • 6
  • 21
  • 39
  • See if this post is of help to you http://stackoverflow.com/questions/8754814/how-to-pass-an-integer-array-to-in-clause-in-mybatis – Ian Lim Apr 03 '14 at 20:03

1 Answers1

1

refer this

SELECT id, title, author   
FROM article   
WHERE id_category
IN    
<foreach item="category" index="index" collection="list"   open="("  separator=","           cose=")">     
#{category}  
</foreach>
Sameer Kazi
  • 17,129
  • 2
  • 34
  • 46