Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't execute a COMPUTE statement [duplicate]

I am trying to execute this simple statement on Northwind database

USE Northwind
SELECT  productid, orderid,quantity 
FROM [order details]
ORDER BY productid, orderid
COMPUTE SUM(quantity)
GO

But I this can't execute , I got this error

Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'COMPUTE'.

like image 509
El Sa7eR Avatar asked Sep 09 '12 11:09

El Sa7eR


People also ask

Can you recode multiple variables at once in SPSS?

If you want to discretize a numeric variable into more than three categories, or if you want to perform a recoding based on more than one variable, you'll need to use DO IF-ELSE IF syntax.

How do I make a new variable from two variables in SPSS?

To compute a new variable, click Transform > Compute Variable. The Compute Variable window will open where you will specify how to calculate your new variable. A Target Variable: The name of the new variable that will be created during the computation. Simply type a name for the new variable in the text field.

How do I select multiple variables in SPSS?

You can also select multiple variables: To select multiple variables that are grouped together in the variable list, click the first variable and then Shift-click the last variable in the group.

How do I combine two categorical variables in SPSS?

In the Categories pane, select the elements you would like to merge together. From the menus, choose Categories > Merge Categories. The Category Properties dialog box is displayed in which you enter a name for the newly created category. The selected categories are merged into the new category as subcategories.


1 Answers

The COMPUTE clause is no longer supported in SQL Server 2012. The documentation suggests using ROLLUP instead.

like image 104
Joe White Avatar answered Sep 21 '22 14:09

Joe White