Hiii..
I had created one table in mysql...and inserted about 320 records in that table. Now I altered that table and added one auto_increment
field. Now it is showing null
value for that field in all records.
Guys please tell me trick to update all 320 record with 1 to 320 in that field.
update formData set ID = (select @rownum := @rownum + 1 AS rank from formData t, (select @rownum := 0)r);
I think below SQL useful to you.
SET @rank:=0;
UPDATE formData
SET ID=@rank:=@rank+1
Thank you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.