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 'group t1,customer t2

时间:2021-04-14 22:46:35
### SQL: select t1.gid,t1.gname,t1.gvalue,t1.gtype, t1.gaddress,t1.gmembers, t1.gcode,t1.gphone, t2.cid ,t2.cname,t2.cgcode from group t1,customer t2 where t1.gcode = t2.cgcode and t1.gid=4;
### Cause: 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 'group t1,customer t2
where t1.gcode = t2.cgcode and t1.gid=4' at line 5

经常我们会运行sql时会报sql语句出错,经常看半天发现sql语法没有错,后来发现是表名是关键字,例如group、user导致了sql出错

下次出错,一定要注意关键字

解决办法:

group两边加上·,就是esc下面那个键·,数字1左边那个·,变成·group·就好了

相关文章