MySQL ERROR 16 (42000):FUNCTION sum does not exist. Check the 'Function Name Parsing and Resolution'

问题很低级,但太隐蔽排查浪费时间,特别记录下。

错误内容:

ERROR 1630 (42000): FUNCTION db_dev.sum does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual

SQL比较简单:

select `id`, sum (`count`) as count, sum (`amount`) as amount
from `t_fact_after_sale`         
where `id` in (1 , 2)  
group by `id`

看到错误时表示很震惊,没有sum函数,不大可能啊。还特意去查了MySQL版本的FUNCTION库,发现并不是这个意思。
也怀疑是不是语法有错,但是也没看语法错误,类似下面这种:

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(之间多了一个空格,手动排版的手残坑。

可能是MySQL基础不太好,从来没注意到函数后面还不能有空格。深刻反思中 . . .

你可能感兴趣的:(#,└,问题和案例集锦)