dimanche 24 avril 2016

UPDATE ORDER BY RAND() LIMIT 100

I want to SET a text different for a field I am trying that kind of code

SET  @rand = 100;
UPDATE myTable SET  name = 'a'  ORDER BY RAND() LIMIT @rand;
UPDATE myTable SET  name = 'b'  ORDER BY RAND() LIMIT @rand;
UPDATE myTable SET  name = 'c'  ORDER BY RAND() LIMIT @rand;

I am getting an error

1221 - Incorrect usage of UPDATE and ORDER BY

thanks for helping




Aucun commentaire:

Enregistrer un commentaire