SET @rank:=0; update yourTABLE set yourTABLE.field=@rank:=@rank+1 WHERE yourTABLE.id IN (3,1,2,5,10) ORDER BY FIELD(id,3,1,2,5,10)  Read More →


Simple example for looping every row in a table Data taken from table: users fields: username, password Data to be placed on table: views fields: username, password Hope this will help... 


If you find this post very useful, please give me comments below. Thanks. DROP PROCEDURE IF EXISTS string_replace; DELIMITER $$ CREATE PROCEDURE string_replace(IN dbname CHAR(250),... 


1. Find and replace string in a column. This is the safest way to test your live data on your localhost to change the realemail address to bogus one. For example, you have a table of...