mercredi 28 juin 2017

How to randomly update a table?

How can I update a table by attributing random values? I wish to randomize the column isOnline

id | name   | isOnline

1 | johndoe | 1
2 | janedoe | 1
3 | marydoe | 0
4 | teendoe | 0
5 | babydow | 1

Query

UPDATE users
SET isOnline = rand(int)
WHERE isOnline='1' OR isOnline='0';




Aucun commentaire:

Enregistrer un commentaire