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'.
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.
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.
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.
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.
The COMPUTE clause is no longer supported in SQL Server 2012. The documentation suggests using ROLLUP instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With