我在创建存储的 mysql 函数时遇到问题。首先,我尝试按照官方教程使其变得非常简单:http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
create function bestalldavaror_7()
RETURNS int DETERMINISTIC
RETURN select sum(mangd) from bestalln where artikel_id = 7;
选择查询本身工作得很好,“mangd”是一个 int(11) 值(该表中的所有内容也是如此)。那么为什么会产生错误:
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 'select sum(mangd) from bestalln where artikel_id = 7' at line 3
最佳答案
因此进行此更改:
create function bestalldavaror_7()
RETURNS int DETERMINISTIC
RETURN (select sum(mangd) from bestalln where artikel_id = 7);
它应该可以工作。
关于mysql - 我的mysql功能不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7395952/