我有一列的表格和以下数据
Status
a1
i
t
a2
a3
我想在我的选择查询中显示以下结果
Status| STATUSTEXT
a1 | Active
i | Inactive
t | Terminated
a2 | Active
a3 | Active
我可以考虑的一种方法是在选择查询中使用 Switch When 表达式
SELECT
status,
CASE status
WHEN 'a1' THEN 'Active'
WHEN 'a2' THEN 'Active'
WHEN 'a3' THEN 'Active'
WHEN 'i' THEN 'Inactive'
WHEN 't' THEN 'Terminated'
END AS StatusText
FROM stage.tst
有没有其他的方法可以让我不需要写 < B > 当表达3次为活跃状态 ,并且可以在一个表达式中检查整个活动状态?