Chapter 4 Exercise 43

43. Compute the total value and count of sales by month for 2010 through 2013. Hint: In Access, use the format string "yyyy-mm", or Year(...)*100+Month(...) for others.

SELECT Format([OrderDate],"yyyy-mm") AS YearMonth,
Sum(Bicycle.SalePrice) AS SumOfSalePrice, Count(Bicycle.SerialNumber) AS CountOfSerialNumber
FROM Bicycle
WHERE (((Bicycle.OrderDate) Between #1/1/2010# And #12/31/2013#))
GROUP BY Format([OrderDate],"yyyy-mm");