有一种方法可以使用OR和CASE WHEN,就像这样?
SELECT
case 'brasil'
when 'chile' OR 'brasil' THEN
'ok'
when 'argentina' then
'ok2'
when 'venezuela' THEN
'ok3'
ELSE
'chaves'
end;
答案 0 :(得分:2)
是的,你正在考虑它。您可以在select..case语句中使用OR或IN:
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;