I’m using sql server 2005.
I have two columns a and b.
I wish to subtract b from a to produce c, which I do as follows:
a – b as c
but I want to complement this by having c = 0 if a or b is 0. How do I do this?
Thanks,
Barry
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try using case
More on this
http://msdn.microsoft.com/en-us/library/ms181765.aspx