월별 티켓 개수 합 MS SQL Query
월별 티켓 개수 합 MS SQL Query
1 2 3 4 5 6 7 8 9 10 11 12 |
SELECT DATEPART(yyyy,Issue_Date) AS Year ,MAX(DATENAME(mm,Issue_Date)) AS Month ,MAX(DATENAME(dd,Issue_Date)) AS DATE ,SUM(COALESCE(GO_TKTCNT,0)) AS TICKET FROM [dbo].[FF_DB] where Regi_Date>'2013-01-01' GROUP BY DATEPART(yyyy,Issue_Date), DATEPART(mm,Issue_Date), DATEPART(dd,Issue_Date) ORDER BY DATEPART(yyyy,Issue_Date),DATEPART(mm,Issue_Date) |