0

This is my code, i have 2 columns - Modem = String, Total = Integer

SELECT `Modem`, `Total`,
CASE `Modem` WHEN 'Yes' THEN
(`Total`+ 50)
ELSE
(`Total`+ 0)
END AS ModemAndTotal
FROM invoices

I need when Modem = "Yes" add 50 to total (Total + 50)

1
  • It is not clear what are you trying to achieve, do you really need 3rd column Modem and total? or you just want to replace column Total? Commented May 3, 2015 at 10:24

1 Answer 1

1

Try something like:

SELECT `Modem`, `Total`, CASE WHEN `Modem` = 'Yes' THEN (`Total`+ 50)
                         ELSE
                         `Total`
                        END AS ModemAndTotal
FROM invoices
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.