幫朋友改個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字段名