Answers for "change date in pivot table to month in sql server"

SQL
0

change date in pivot table to month in sql server

SELECT *
FROM (SELECT YEAR(SalesDate) [Year], 
       DATENAME(MONTH, SalesDate) [Month], 
       COUNT(1) [Sales Count]
      FROM #Sales
      GROUP BY YEAR(SalesDate), 
      DATENAME(MONTH, SalesDate)) AS MontlySalesData
PIVOT( SUM([Sales Count])   
    FOR Month IN ([January],[February],[March],[April],[May],
    [June],[July],[August],[September],[October],[November],
    [December])) AS MNamePivot
Posted by: Guest on December-09-2020

Code answers related to "change date in pivot table to month in sql server"

Code answers related to "SQL"

Browse Popular Code Answers by Language