Answer the question
In order to leave comments, you need to log in
How to randomly sort and change a field?
Tell me. There is a table. It contains many different drinks. How to make them sort randomly and change the gender value
id | position | name
1 | 1 | test
2| 2| test2
3| 3| test3
id | position | name
1 | 1 | test
2| 3| test3
3| 4| test2
Answer the question
In order to leave comments, you need to log in
SET @incr = 0;
UPDATE myTable
SET position = @incr :[email protected] + 1
ORDER BY RAND();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question