且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MySQL中选择随机行

更新时间:2023-02-07 13:32:03

您可以使用

You can use the rand function in MySQL to order the rows, and then take the top 10 (or however many you want) with limit.

select * from table order by rand() limit 10

如果您只想数学问题:

select * from table where type = 1 order by rand() limit 10