Consider example:
考虑示例:
case when type = 'myValue' then 'default' else type end
how to listed several values here type = 'myValue'
? Instead of duplicating:
如何在这里列出几个值type ='myValue'?而不是重复:
case
when type = 'myValue' then 'default'
when type = 'other' then 'default'
else type
end
1 个解决方案
#1
2
You can use any condition in a when
clause. E.g., in your case, you could use the in
operator:
您可以在when子句中使用任何条件。例如,在您的情况下,您可以使用in运算符:
case
when type in ('myValue','other') then 'default'
else type
end
#1
2
You can use any condition in a when
clause. E.g., in your case, you could use the in
operator:
您可以在when子句中使用任何条件。例如,在您的情况下,您可以使用in运算符:
case
when type in ('myValue','other') then 'default'
else type
end