四种数据库随机获取N条数据的方法
1.SQL Server:
SELECT TOP n * FROM tableName ORDER BY NEWID();
2.ORACLE:
SELECT * FROM (SELECT * FROM tableName ORDER BY DBMS_RANDOM.RANDOM()) WHERE RONUM <= n
3.MySQL:
SELECT * FROM tableName ORDER BY RAND() LIMIT n
3.Access:
SELECT TOP n * FROM tableName ORDER BY rnd([一个自动编号字段])
Ps: n 是你要取的条数.O(∩_∩)O~