declare c int
set c = 1
while c<700 do
update users set profile_display_name = concat(substring(first_name,1,1), last_name)
where profile_display_name is null and id between ((c-1)*10000+1) and (c*10000);
SET c = c+1;
End while ;
我得到错误。近声明时结束声明。我在哪里犯错?MYSQL - 使用while循环更新
我试过了,我来自SQL背景。我什么都猜不出。有任何建议吗? – pavelcc 2012-03-28 20:51:29
你使用的是什么版本的MySQL? – 2012-03-28 20:58:16
这段代码是触发器还是存储过程的一部分?你会得到什么错误? – 2012-03-28 21:07:49