今天写完sql之后,利用postman进行测试接口的时候,服务器给我报了如下的错误:Cause: java.sql.SQLSyntaxErrorException: 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 ‘SUM(CASE WHEN callType = ‘0’ THEN 1 ELSE 0 END) AS hrnum, --呼入量
SU’ at line 40
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: 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 ‘SUM(CASE WHEN callType = ‘0’ THEN 1 ELSE 0 END) AS hrnum, --呼入量
SU’ at line 40
我看自己sql语句也没有语法错误,为什么报了如下错误呢,后来检查发下是自己的注释出现了问题。
原来通过检索发现。
在sql文件中的注释必须以 – 注释,–之后必须有空格才可以。
那么希望大家以后写注释的时候也要注意这些细节。