| 订阅 | 在线投稿
分享
 
 
 

读取随机记录的例子 SQL语句

来源:互联网  宽屏版  评论
2008-12-13 08:23:50

帮朋友改个asp的相关产品显示要用到随机读取当前类别的前10个产品,Google了下收藏的

mysql中随机提取数据库记录

-------------------------------------------------------------------------------- view plaincopy to clipboardprint?

select * from tablename order by rand() limit 10

select * from tablename order by rand() limit 10sqlserver中随机提取数据库记录

-------------------------------------------------------------------------------- view plaincopy to clipboardprint?

select top 10 * from tablename order by NEWID()

select top 10 * from tablename order by NEWID()Access中随机提取数据库记录

-------------------------------------------------------------------------------- view plaincopy to clipboardprint?

SELECT top 10 * FROM tablename ORDER BY Rnd(FId)

SELECT top 10 * FROM tablename ORDER BY Rnd(FId)FId:为你当前表的ID字段名

帮朋友改个asp的相关产品显示要用到随机读取当前类别的前10个产品,Google了下收藏的 mysql中随机提取数据库记录 -------------------------------------------------------------------------------- view plaincopy to clipboardprint? select * from tablename order by rand() limit 10 select * from tablename order by rand() limit 10sqlserver中随机提取数据库记录 -------------------------------------------------------------------------------- view plaincopy to clipboardprint? select top 10 * from tablename order by NEWID() select top 10 * from tablename order by NEWID()Access中随机提取数据库记录 -------------------------------------------------------------------------------- view plaincopy to clipboardprint? SELECT top 10 * FROM tablename ORDER BY Rnd(FId) SELECT top 10 * FROM tablename ORDER BY Rnd(FId)FId:为你当前表的ID字段名
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号wangchaonetcn
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有