IN statement in SQL doesn’t accept a wild character (SAP)
Check out the below SQL:
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 t.afdeling IN (?4) AND s.sid IN (?5)
ORDER BY ID DESC
Parameters:
java.sql.Timestamp, java.sql.Timestamp, java.lang.String, java.lang.String, java.lang.String, java.lang.String
In this only 2 parameters are mandatory and when other parameters are not passed and I'm using the character '%' for the LIKE statement so all data will be shown. Any idea how to solve this in IN statement?