Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Regarding partition by clause

Author  Topic 

ujjwol38
Starting Member

1 Post

Posted - 2008-08-09 : 13:37:41
Hi

I run the following query and end up getting the error
" Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'order'."

Can anybody help me with this

The Query:

SELECT empid, CONVERT(VARCHAR(7), ordmonth, 121) AS ordmonth, qty,
SUM(qty) OVER(PARTITION BY empid ORDER BY ordermonth) AS runqty
FROM dbo.EmpOrders;

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-09 : 14:15:17
you cant use ORDER BY clause with aggregate functions like SUM(),COUNT(),...
Go to Top of Page
   

- Advertisement -