mysql 中 select中 用case

将 countertype 整数类型转成字符串类型

SELECT counterType, CASE counterType
WHEN 1 THEN 'CTP'
WHEN 2 THEN 'NULL'
WHEN 3 THEN '飞鼠'
WHEN 4 THEN '飞鼠 FIX'
WHEN 5 THEN 'CTP FIX'
WHEN 6 THEN 'QuantHub'
ELSE 'default'
END AS counterName
FROM urls

原文地址:https://www.cnblogs.com/a9999/p/6248676.html