请注意,SQL中的IN语句不接受通配符。您必须使用OR / AND使其工作,如下 :
select * from Test1 t INNER JOIN Test2 s ON t.ID = s.RID where t.sdate >= ?1 AND t.edate <= ?2 AND t.id LIKE ?3 AND ('%' = ?4 OR t.afdeling IN (?4)) AND ('%' = ?5 OR s.sid IN (?5)) ORDER BY ID DESC
如果您使用参数位置传递参数,请尝试如下更改:
AND ('%' = ?4 OR t.afdeling IN (?5)) AND ('%' = ?6 OR s.sid IN (?7))