Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query Help

Author  Topic 

mrgalvan
Starting Member

9 Posts

Posted - 2006-08-10 : 11:48:49
I'm trying to create a query using SUM. I'm obviously doing something wrong here. Any help?


SUM((CT.TotMaterialCost + CT.TotFreightCost) / (SUM(CT.OrigQty - CT.QtyUsed))) > '0'
Cannot perform an aggregate function on an expression containing an aggregate or a subquery.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-08-10 : 12:00:56
Post your full query.
Also explain what you are trying to do

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-08-10 : 12:02:47
U have something like

Sum(.... Sum(...) ...)

U may need to change that to

Sum (DT.Sum_of_DerivedTbl) from
( Select Sum(....) as Sum_of_DerivedTbl from ....) as DT

-- Something else
> '0' should be > 0

Srinika
Go to Top of Page
   

- Advertisement -