Access,Sql Server,MySql,Oracle從數(shù)據(jù)庫里隨機(jī)獲取幾條數(shù)據(jù)
Access:
select top n * from table order by rnd(id)‘id為數(shù)據(jù)庫的自動(dòng)編號字段
Sql Server:
select top n * from table order by newid()
MySQL:
SELECT * FROM table order by rand() limit 20;
Oracle:
select * from table order by dbms_random.value()
原文鏈接:Sql Server從數(shù)據(jù)庫里隨機(jī)獲取幾條數(shù)據(jù)