时间:2021-07-01 10:21:17 帮助过:4人阅读
Mysql:select * from [tablename] order by rand() limit 10
Sql Server:select top 5 * from [tablename] order by NEWID()
Access:select top 5 * from [tablename] order by rnd(id),其中id是自动编号的字段。在vb+access可以随机,但在asp里却没法得到随机的结果。可能是asp有缓存的结果吧,因此,需要修改一下这条语句,改为下面的方式:
randomize
select top 5 * from [tablename] order by rnd(-(id+rnd()))
sql随机抽取数据
标签: