Selecting random value in MySQL
SELECT FLOOR(1 + (RAND() * 100))
where 100 is a maximum allowed number in random sequence
Comments Off
SELECT FLOOR(1 + (RAND() * 100))
where 100 is a maximum allowed number in random sequence
Comments Off
This example will update a year in table field which was wrongly set to 2011 and set it to 2010.
e.g. 2011-09-20 will be changed to 2010-09-20 throughout the table.
UPDATE $table \ SET $field = $field - INTERVAL 1 YEAR \ WHERE year($field)=2011;
Comments Off