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 when

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-09-10 : 10:23:17
I have a question about how would I write a case with 3 fields. total01, total02, total03.

I want it to say case when total01 or total02 or total03 has a value post results. If all 3 are = 0 dont post results. If one has a total post all results.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-10 : 10:40:46
SELECT ...
FROM ...
WHERE Total01 + Total02 + Total03 > 0



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-09-10 : 10:46:32
that worked great thank you. i thought it would be something simple but was not sure exactly what I needed to do.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-10 : 10:50:05
SELECT ...
FROM ...
WHERE Total01 > 0
OR Total02 > 0
OR Total03 > 0



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -