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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 case statement with a select sum ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jylland
Starting Member

27 Posts

Posted - 12/10/2012 :  11:44:29  Show Profile  Reply with Quote
is this here posible

How do I SUM(Values)- Select SUM(value2) as test

I have problem with "SUM(Values)- test"

My code

SELECT SUM(value) AS Totalos....
Case When SUM(Values) > 0 then 0 Else SUM(Values)- Select SUM(value2) as test from anothertable...


nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3383 Posts

Posted - 12/10/2012 :  12:32:38  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
you need an end

SELECT SUM(value) AS Totalos....
Case When SUM(Values) > 0 then 0 Else SUM(Values) end - Select SUM(value2) as test from anothertable...



==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jylland
Starting Member

27 Posts

Posted - 12/11/2012 :  05:24:21  Show Profile  Reply with Quote
quote:
Originally posted by nigelrivett

you need an end

SELECT SUM(value) AS Totalos....
Case When SUM(Values) > 0 then 0 Else SUM(Values) end - Select SUM(value2) as test from anothertable...



==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.



Great job nigelrivett Thanks
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.05 seconds. Powered By: Snitz Forums 2000