我在表中存储了日期,我想按月分组,而我没有在表中存储月份是否可能如果它然后如何? [英] I Have Stored Dates In A Table And I Want To Group It By Months While I Didn't Store Months In A Table Is It Possible If Its Then How?

查看:72
本文介绍了我在表中存储了日期,我想按月分组,而我没有在表中存储月份是否可能如果它然后如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将日期存储在一个表格中,我希望按月分组,而我没有在表格中存储月份是否可能如果它可以如何?

解决方案

试试这个



从yourTable组中选择count(YourColumnName)by datepart(MM,YourColumnName)


I have stored dates in a table and i want to group it by months while i didn't store months in a table is it possible if its then how?

解决方案

try this

select count(YourColumnName) from yourTable group by datepart(MM,YourColumnName)


这篇关于我在表中存储了日期,我想按月分组,而我没有在表中存储月份是否可能如果它然后如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆