there is a way to use OR with CASE WHEN, like this?
SELECT
case 'brasil'
when 'chile' OR 'brasil' THEN
'ok'
when 'argentina' then
'ok2'
when 'venezuela' THEN
'ok3'
ELSE
'chaves'
end;
Yes, you are thinking about it correctly. You can use OR or IN with your select..case statement:
select
case
-- one way or writing OR
when country = 'brasil' or country = 'chile' then '....'
-- another way of writing OR
when country in ('china', 'japan') then '...'
else '..'
end
from tablename;
Example: http://sqlfiddle.com/#!15/c1cef/2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With