March 15, 2013 at 1:21 am
HI
SELECT SalesOrderID, UnitPrice, UnitPriceDiscount
FROM Sales.SalesOrderDetail
WHERE SalesOrderID = 43659
ORDER BY SalesOrderID
COMPUTE SUM(UnitPrice), SUM(UnitPriceDiscount) BY SalesOrderID;
Above query is giving below error
Incorrect syntax near the keyword 'COMPUTE'.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
March 15, 2013 at 3:27 am
What version of SQL Server are you connected to?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 15, 2013 at 7:00 am
ChrisM@Work (3/15/2013)
What version of SQL Server are you connected to?
And what compatibility level is set for the database?
March 15, 2013 at 7:57 pm
We're in a 2012 Forum so I'll assume SQL 2012. Support for COMPUTE was dropped from SQL Server 2012 and is not available under any compatibility mode. Use ROLLUP instead.
http://technet.microsoft.com/en-us/library/ms144262.aspx
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply