Depending on the expected result it can either be wrong or right:
SUM(OrderQty) OVER (Partition by productID) as TotalOrderQty,
will return the Quantity for the year 2001 per productID.
But if you're looking for the monthly quantity you might want to use
SUM(OrderQty) OVER (Partition by MONTH(OrderDate),productID) as TotalOrderQty,
ROW_NUMBER() OVER (Partition By MONTH(OrderDate) Order by OrderQty desc) as Rows
will sort the [Rows] based on the highest single OrderQty in a given month, regardless of the product or any cumulated values.
I'm not sure if this is what you're looking for...
LutzA pessimist is an optimist with experience.
How to get fast answers to your question[/url]
How to post performance related questions[/url]
Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]