Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

BdN3504 on "How to create a random Number for menu_order in MySQL"

$
0
0

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.


Viewing all articles
Browse latest Browse all 5530

Trending Articles