我想寫這樣的查詢:如何編寫有效的查詢(使用自動增量變量更新)?
SET @id := 0;
UPDATE table1
SET
field1 = @id + 1,
@id := @id + 1
並獲得錯誤信息:
#1064 - 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 '@id := @id + 1' at line 3
如何正確地寫這個查詢?
THX,它的工作! – nex2hex 2010-09-28 15:15:35