Hello all I am using MS SQL Server 2008 R2 and needed some help with a small query
Here is my table:
Orders
-----------------
OrderID Date(datetime) Quantity
I need to find the avg, max and min quantity of each month. and also display the YEAR and Month
Because of thee requirements I was going to take the aproach of grouping by Month and then getting avg max and min through this. Is it possible? here is what i have so far
Select YEAR(Orders.Date), MONTH(Orders.Date)
From Orders
Assuming that you want to group by month and year, you can do it like this: