Grouping column by DateTime

这一生的挚爱 提交于 2019-12-13 05:09:10

问题


I'd like to grouping a column by a DateTime field (Months)

The values of this field are how this: 2014-12-16T12:56:06.32+01:00

How should be the expression to make a primary group by column?

Best regards


回答1:


You can use this query :

select SUBSTR(COLUMN_NAME,6,2) as "MONTH",count(*) from TABLE_NAME group by 
substr(COLUMN_NAME,6,2);

You can add columns in group by as per requirement.

Note : Columns in group by should be present in select.




回答2:


Group by the record in SSRS design .

In the group by record column expression ,give following query

=MonthName(Month(Fields!ListingDate.Value))



来源:https://stackoverflow.com/questions/27617014/grouping-column-by-datetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!