巴扎黑2017-04-18 10:10:21
SELECT *, rand() '_RAND' FROM XXX_TABLE ORDER BY _RAND LIMIT 0,200;
使用rand()
Generate random number sorting and take out the first 200 items.
PHP中文网2017-04-18 10:10:21
Then you choose 200, but it can’t be random. You can use the same idea of paging mysql limit x,x+200 oralce where rownum<x+200 ) where rownum>x;
阿神2017-04-18 10:10:21
Try something like this
SELECT * FROM users WHERE userId >= ((SELECT MAX(userId) FROM users)-(SELECT MIN(userId) FROM users)) * RAND() + (SELECT MIN(userId) FROM users) LIMIT 200