473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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

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
1 1215
Rabbit
12,516 Expert Mod 8TB
Looks like you already have the SQL to do that. What problem are you having with it?
Sep 19 '13 #2

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

Similar topics

2
by: bafidi | last post by:
i write a number to textbox1.text i want to learn if it is negative or positive
12
by: deko | last post by:
Is there an easy way to make all negative values positive in a particular table? I've been experimenting with this: Dim rst As DAO.Recordset Set rst = db.OpenRecordset("tblNegValues") Do...
19
by: Johs | last post by:
I need to make some special action if 'a' and 'b' are both positive or both negative. Is there some inbuilt function to check this? Johs
2
by: STEPHENSS | last post by:
Hi, New to SQL. I need to reverse the signs, for example I have an amount of -1,500.00 and I need to change the the Amount to 1,500.00 and all positives amount to a negative amount also. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.