我想顯示在我的博客文章歸檔(按月和年),我不知道如何編寫sql select命令。TSQL顯示博客檔案
我有表Articles
,並有PublishDate
(這是日期時間類型)列,我必須爲此表選擇唯一的PublishDate
,但僅限於月和年。
例如,如果我在2013年9月有3個帖子,那麼2013年9月將只顯示一次。
結果應該是這樣的:
September 2013
Novermber 2013
January 2012
etc.
有人可以幫我這個TSQL SELECT命令?
聽起來像是你只需要使用[DISTINCT](http://www.w3schools.com/sql/sql_distinct.asp)。 – Mike