幫朋友改個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字段名
新聞熱點
疑難解答