Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CASE question

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-06-02 : 10:27:10
I am using a case to find out totals and I have a question about trying to use the same case but have another field I want to add to make it a true statement.

This is the current case statment and works
SUM(CASE WHEN action = 'b' THEN glamt ELSE 0000000.00 END) AS RentalBilling

What I want it to say is case when action = 'b' and from field SRC = 'RO' and 'RR' THEN glamt ELSE 0000000.00 END) AS RentalBilling

So if action =b, RO and or RR then post glamt.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-02 : 10:29:06
SUM(CASE WHEN action = 'b' AND SRC IN ('RO','RR') THEN glamt ELSE 0000000.00 END) AS RentalBilling
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 10:29:14
SUM(CASE WHEN action = 'b' AND SRC IN ('RO', 'RR') THEN glamt ELSE 0.0 END) AS RentalBilling



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-02 : 10:29:42


by colorcoding...



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-02 : 10:30:23
quote:
Originally posted by Peso



by colorcoding...



E 12°55'05.25"
N 56°04'39.16"



8 secs
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-06-02 : 10:31:28
what a race photo finish! :)
Go to Top of Page
   

- Advertisement -