巴扎黑2017-04-17 16:45:36
select * from a order by b desc
The front of the returned result set has a higher weight
For example
--------------
|b | 其余字段|
--------------
|100| xxxxxxx|
--------------
|97| xxxxxxx|
--------------
|6 | xxxxxxx|
--------------
|5 | xxxxxxx|
-------------
PHP中文网2017-04-17 16:45:36
How can you sort if you only fetch one piece of data... Just randomly fetch one piece and that's it. Upstairs, if you need to fetch multiple pieces, you need to sort them with one layer of sql. select * from (select * from a order by rand() limit n) aa order by b desc;