解讀select top x * from ...order by xxx desc

select top x * from ...order by xxx desc

按xxx降序順序取出最上面的x條記錄

 

sql="select top 4 * from SW_article where  Passed=1 and IsGood=1 and minipic<>'' and stype<>'1' and UpdateTime>"&sysdate&"-7 order by Hits desc, ArticleID desc"

按Hits(點擊率)和ArticleID(自動編號,即最後更新)降序排列【即選出最後更新裏邊點擊率最高的4個文章】

且要符合Passed=1 (1審覈0未審覈)and IsGood=1 (1推薦0爲推薦)and minipic<>'' and stype<>'1' and UpdateTime>"&sysdate&"-7(更新時間大於以當天爲準前七天的時間)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章