SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

mrgalvan
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.

madhivanan
Premature Yak Congratulator

India
22754 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

Madhivanan

Failing to plan is Planning to fail

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

Srinika
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

Srinika

Edited by - Srinika on 08/10/2006 12:03:37
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.08 seconds. Powered By: Snitz Forums 2000