I am having a problem with this compute by clause
The statement is a simple select
Select col1, col2 from table1
where <where clause>
order by col1
Compute Sum(col2) by col1
I want the display to show details and group totals.
The error message I keep getting is
Server: Msg 410, Level 16, State 2, Line 1
COMPUTE clause #1 'BY' expression #1 is not in the order by list.
I have previously used the compute clause so I know it should work !!
Ay help will be appreciated - Thank you.This is working for pubs - I do not see the difference.
SELECT type, price
FROM titles
ORDER BY type
COMPUTE SUM(price) BY type|||I saw this very same example and did my query and it doesn't work. I don't have the pubs database so I created a titles table and inserted some data and then ran this same query and that too gave me the same error !!!
Originally posted by snail
This is working for pubs - I do not see the difference.
SELECT type, price
FROM titles
ORDER BY type
COMPUTE SUM(price) BY type|||Originally posted by CSC
I saw this very same example and did my query and it doesn't work. I don't have the pubs database so I created a titles table and inserted some data and then ran this same query and that too gave me the same error !!!
I am afraid you have a problem with your sql server - is it microsoft 2000?|||Yes it is Microsoft Sql Server 2000. This is really strange !!
Originally posted by snail
I am afraid you have a problem with your sql server - is it microsoft 2000?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment