| 導購 | 订阅 | 在线投稿
分享
 
 
 

讀取隨機記錄的例子 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- 王朝網路 版權所有