开发者

Error in my stored-procedure

i have an error in my stored-procedure. I use MySql DB

SET @counter = 1;
SET @last = 0;
UPDATE Customer SET ordre = (IF(@last = customer_id,@counter + 1,@counter = 1)),
                 @last = cu开发者_如何学编程stomer_id

My Error

Script line: 3 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 '@last = customer_id ORDER BY customer_id' at line 2


You cannot set variables in SET clause of UPDATE statement. '@last = customer_id' causes the error.

From the reference -

UPDATE syntax - '...SET col_name1=expr1 [, col_name2=expr2 ...]'

The SET clause indicates which columns to modify and the values they should be given.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜