On the mysql irc channel this code was suggested:
SET @rank := 0; UPDATE posts SET menu_order = @rank := @rank + 1 where gmr_posts.post_type = 'my_cpt' ORDER BY RAND();
This works well enough, although i don't really understand the code and i don't know how to specify the range.
↧
BdN3504 on "How to create a random Number for menu_order in MySQL"
↧