Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

COMPUTE Clause problem Expand / Collapse
Author
Message
Posted Friday, March 15, 2013 1:21 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 2:36 AM
Points: 2,840, Visits: 3,970
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
Post #1431382
Posted Friday, March 15, 2013 3:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 2:54 AM
Points: 6,781, Visits: 13,984
What version of SQL Server are you connected to?

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

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
Exploring Recursive CTEs by Example Dwain Camps
Post #1431422
Posted Friday, March 15, 2013 7:00 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, October 15, 2014 5:41 AM
Points: 1,191, Visits: 9,886
ChrisM@Work (3/15/2013)
What version of SQL Server are you connected to?


And what compatibility level is set for the database?
Post #1431515
Posted Friday, March 15, 2013 7:57 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:06 PM
Points: 7,125, Visits: 12,720
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
Post #1431857
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse