需要使用MySql DB上的jdbc模板对选择查询应用限制和偏移量。
String query = "SELECT *from loaquesform F inner join loainfo N inner join loa_approval A on F.loaId = N.loaId and N.loaId = A.loaId where loaStatus IN (?) LIMIT ?, ? order by loaId desc;"
LoaFormList = userJdbcTemplateMysql.query(query,
new BeanPropertyRowMapper(LoaFormWithSrv.class),
new Object[]{loaStatusCriteria.getLoaStatus(),loaStatusCriteria.getLimit(),
loaStatusCriteria.getOffset()});
我正在使用限制和偏移量= 10调用此程序
我低于错误-
> You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near ''10', '10' order by loaId desc' at line 1
最佳答案
ORDER BY
needs to be preceded通过LIMIT
子句:
String query =
"SELECT * from loaquesform F inner join loainfo N inner join loa_approval A on F.loaId = N.loaId and N.loaId = A.loaId where loaStatus IN (?) order by loaId desc LIMIT ?, ?;"
关于java - 如何通过MySql DB上的Spring Jdbc模板在获取列表中应用限制和偏移量,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55746832/