Oracle查询结果集,随机排序
select * from table1 order by dbms_random.value();
MySQL随机查询出一条记录:
-- 下面的查询语句效率高,不要使用 SELECT * FROM table1 ORDER BY rand() LIMIT 1 来查询 SELECT * FROM table1 WHERE id=(SELECT id FROM table1 ORDER BY rand() LIMIT 1)
查询结果集,随机排序
SELECT * FROM table1 ORDER BY rand()
MS SQL Server
SELECT *
FROM Northwind Orders
ORDER BY NEWID()
SELECT TOP 10 *
FROM Northwind Orders
ORDER BY NEWID()
本文地址:https://www.stayed.cn/item/17765
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我