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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query Help
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

9 Posts

Posted - 08/10/2006 :  11:48:49  Show Profile  Reply with Quote
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.

Premature Yak Congratulator

22864 Posts

Posted - 08/10/2006 :  12:00:56  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Post your full query.
Also explain what you are trying to do


Failing to plan is Planning to fail

Edited by - madhivanan on 08/10/2006 12:01:55
Go to Top of Page

Flowing Fount of Yak Knowledge

Sri Lanka
1378 Posts

Posted - 08/10/2006 :  12:02:47  Show Profile  Reply with Quote
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


Edited by - Srinika on 08/10/2006 12:03:37
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000