3

Consider example:

case when type = 'myValue' then 'default' else type end

how to listed several values here type = 'myValue'? Instead of duplicating:

case
     when type = 'myValue' then 'default'
     when type = 'other' then 'default'
     else type
end
Mureinik
  • 297,002
  • 52
  • 306
  • 350
Cherry
  • 31,309
  • 66
  • 224
  • 364

1 Answers1

2

You can use any condition in a when clause. E.g., in your case, you could use the in operator:

case
     when type in ('myValue','other') then 'default'
     else type
end
Mureinik
  • 297,002
  • 52
  • 306
  • 350