需要使用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
答案 0 :(得分:0)
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 ?, ?;"