order by monthly in sql

Solutions on MaxInterview for order by monthly in sql by the best coders in the world

showing results for - "order by monthly in sql"
Gianluca
20 Mar 2018
1SELECT     { fn MONTHNAME(OrderDate) } AS MonthName, YEAR(OrderDate) AS Year, SUM(TotalValue) AS Profits
2FROM         [Order]
3WHERE     (YEAR(OrderDate) = @year)
4GROUP BY { fn MONTHNAME(OrderDate) }, MONTH(OrderDate), YEAR(OrderDate)
5order by Year(orderDate),month(OrderDate)
6