我需要在查询中使用 IN,其格式如下:
@Select("SELECT max(count) FROM whatevertable WHERE id IN (#{xyz})")
public int doSomething(List<Integer> xyz)
我尝试搜索,但发现 XML 中的各种功能,但我的要求是使用 JAVA。 谁能帮我解决这个问题吗?
最佳答案
引用this
SELECT id, title, author
FROM article
WHERE id_category
IN
<foreach item="category" index="index" collection="list" open="(" separator="," cose=")">
#{category}
</foreach>
关于java - 如何在 myBatis 的查询中使用 IN(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22784111/