I need to use some queries like
select * from StudentTable where ${columnName}=#{columnValue}
Note that columnName and columnValue are provided by user. I'm using spring boot application with Mybatis. This query works as intended but it reports the possibility of SQL Injection in some tools. How can I make this work in a different way?
select * from StudentTable where #{columnName}=#{columnValue}
This will not work, no output.
Select * from StudentTable where Joiningdate < NOW()-INTERVAL '${configureddays} DAY'
This one also reports the possibility of SQL Injection but the query works. Replacing with # will not help here too. How can I restructure both these queries?