MySQL报错com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'DESC'

如果你用的数据库是MySQL8.0,那么请将group by 改为order by,因为在8.0之前,group by 包含using filesort,而8.0开始是没有的,为了避免这种问题,8.0开始除了索引替换排序的优化思路之外的相关排序,我们都必须使用order by来进行。

posted @ 2019-11-01 15:05  珞裳夜色  阅读(319)  评论(0编辑  收藏  举报