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