By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

How do i sum the 'No. of Negative Cases', 'No. of Positive Cases' as well as 'No. of

P: 1
Expand|Select|Wrap|Line Numbers
  1. select case when  adjAmount < 0 then 'No. of Negative Cases'
  2.             when  adjAmount > 0 then 'No. of Positive Cases'
  3.             else 'No. of Null Cases'
  4.             end as Report,procEndDate,
  5.             count(adjAmount)
  6. from dbo.tblProductivity_HIS_DEV8 
  7.  
  8. where procEndDate between '2013-04' and '2014-04' and procstatus = 'Complete' and inventory = 'N'
  9. and (reportingBucketCategory = 'Audit' or
  10. (reportingBucketCategory = 'Services' and (adjAmount = 0.00 or adjAmount is null)) or
  11. (reportingBucketCategory is null and (adjAmount = 0 or adjAmount is null or adjAmount > 0)))
  12.  
  13. group by  case when  adjAmount < 0 then 'No. of Negative Cases'
  14.             when  adjAmount > 0 then 'No. of Positive Cases'
  15.             else 'No. of Null Cases'
  16.             end,procEndDate
  17. order by procEndDate
Sep 19 '13 #1
Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,430
Looks like you already have the SQL to do that. What problem are you having with it?
Sep 19 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.