SQL Server QOD
This is the Question that appeared in SQL Central -
SELECT COUNT(*) AS OrderCount,
MONTH(OrderDate) AS OrderMonth,
YEAR(OrderDate) AS OrderYear
FROM Orders
GROUP BY OrderDate
ORDER BY OrderDate
Assume that the column and table names are correct and that OrderDate is a dateTime column. What is wrong with this query?
Answer:
The query will run without error, but will give the count of orders by order date, not summarized by month and year
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home