groups在MySQL8.0.2中已作为保留关键字

数据库从MySQL5.7迁移到MySQL8时,一条简单的SQL

SELECT * FROM groups groups WHERE status = 'open' ORDER BY memberNum DESC LIMIT 6 OFFSET 0

竟然报错。

[Err] 1064 - 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 'groups groups WHERE status = 'open' ORDER BY memberNum DESC LIMIT 6 OFFSET 0' at line 1

找了一遍,发现groupsMySQL8.0.2中已是保留关键字。

怎么办?只能改。

Leave a Reply