samedi 27 janvier 2018

MySQL - Copy data from one table into another in a random order

I have created a new table identical to the original one and I would like to copy all the data to the new table in a random way.

I use:

INSERT INTO `new_table` ('id', 'value') 
    SELECT 'id', 'value' FROM `original_table` ORDER BY RAND();

But as result I get new table in the same order as original one. For some reason RAND() is not working.




Aucun commentaire:

Enregistrer un commentaire