如何實現MSSQL中Sql標簽select隨機讀取數據select隨機讀取數據以及數據記錄隨機排序{king:sql cmd="select top 15 artid,arttitle,artpath,artdescription,artshow from kingart where listid=7 and artshow=1 order by right(cstr(rnd(-int(rnd(-timer())*100+artid)))*1000*Now(),2);"}
<li><a href="/Symptom/(king:#2/)" title="(king:#3/)">(king:#1/)</a></li>{/king}
做一個筆記,這個記錄,是從KingCMS的kingart數據表中隨機讀取15條數據,隨機排序.重點就在
order by right(cstr(rnd(-int(rnd(-timer())*100+kid)))*1000*Now(),2)
另外還有種寫法 order by rnd(artid) desc;