新聞資料,欄位是有日期,ID,標題,等
在側邊欄我想通過,日期來歸檔,顯示要求如下:
2020-7(5)
2020-6(5)
2020-4(1)
2019-12(6)
其中表示,年年年看-月,括號中數字表示,當前月份中有幾個新聞.
麻煩高手幫一下,這個查詢的SQL要怎么寫,欄位日期中記錄格式是:2020/6/20 10:11:07
資料庫:Access
表名:News
ID欄位名:NewsID
日期欄位名:NewsTime
標題欄位名:NewsTitle
uj5u.com熱心網友回復:
select year(newstime)+'-'+month(newstime) as ndate,count(1) as c from news group by year(newstime)+'-'+month(newstime) order by year(newstime) desc,month(newstime) desc隨手寫的,試試吧
uj5u.com熱心網友回復:
select Format(NewsTime,'yyyy-M')+'('+Format(count(*),'')+')' from NEWS group by Format(NewsTime,'yyyy-M')
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/21966.html
標籤:ASP
