Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

mysql update from n to 100

SET @rank:=0;
update tablename
set fieldname =@rank:=@rank+1;

#OR

UPDATE tablename
JOIN (SELECT @rank := 0) r
SET fieldname=@rank:=@rank+1;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mysql #update
ADD COMMENT
Topic
Name
8+4 =