按月/年分组日期 [英] To group date by month /year
本文介绍了按月/年分组日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
抱歉,基督徒...
我想将数据库中的日期分组为月份..自2007年以来,我一直有数据.我该如何进行?
尽快等待回复
非常感谢
Shaheen
Hi
Sorry to Christian...
I want to group date from DB in month..I have data since yr 2007.How do i proceed?
Awaiting a response ASAP
Many Thanks
Shaheen
推荐答案
您可以使用month函数.
You can use the month function.
SELECT *
FROM [Table Name]
ORDER BY MONTH([Date Column Name])
按年份分组,然后按月份分组.
Group by Year, then by Month.
select year([date_column]), month([date_column]), count('')
from [table_name]
group by year([date_column]), month([date_column])
order by 1 desc, 2 desc
;
这篇关于按月/年分组日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文