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
 Sum calculated columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

vignesht50
Yak Posting Veteran

76 Posts

Posted - 03/12/2014 :  06:10:58  Show Profile  Reply with Quote
Hi,

How can I sum the calculated columns.

select [Funding] [Fundings], [Original] [Originals],[Variance] = [Previous_Year]-[Current_Year],[SumValue] = [CurrentYear]/4, [ActualValue] = [Variance] * 0.75,[FinanceYear], [New Value] = [Previous_Year]+[Current_Year] from Finance

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/12/2014 :  07:01:36  Show Profile  Reply with Quote
how about?

SELECT fundings,originals,sum(Variance),sum(sumValue),sum(actualValue),sum(newvalue)
FROM (
select [Funding] [Fundings]
,[Original] [Originals]
,[Variance] = [Previous_Year]-[Current_Year]
,[SumValue] = [CurrentYear]/4
,[ActualValue] = [Variance] * 0.75,[FinanceYear]
,[NewValue] = [Previous_Year]+[Current_Year]
from Finance
)A
Group by fundings,originals

Cheers
MIK
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.06 seconds. Powered By: Snitz Forums 2000