SELECT DATEPART(Year ,DateCol) As 'Year' ,DATEPART(Month ,DateCol) As 'MTH' ,Round(SUM(YourDataColumn),2) As 'kWh'FROM YourTableWHERE ...YourCriteriaGROUP BY DATEPART(Year ,DateCol) , DATEPART(Month ,DateCol)
SELECT DATEPART(Year ,DateCol) As 'Year'
,DATEPART(Month ,DateCol) As 'MTH'
,Round(SUM(YourDataColumn),2) As 'kWh'
FROM YourTable
WHERE ...YourCriteriaGROUP BY DATEPART(Year ,DateCol) , DATEPART(Month ,DateCol)
No comments:
Post a Comment