问题很低级,但太隐蔽排查浪费时间,特别记录下。
错误内容:
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基础的自(mi)信(mang),去查了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修炼还不够,深刻反思中 . . .