I am using SQL Server 2008 R2.
I am trying to write a query showing the following:
select productname, unitprice,categoryid, sum(unitprice)
over (partition by categoryid order by unitprice desc) As PriceSum
from Products
I want the result to order products at their unit price, when dividing the products into their categories. I get this error: Incorrect syntax near 'order'.
What am I doing wrong?
source
share