参考如下用例:
SELECT user_id, rights_code, num, remain_num,
CASE rights_code
WHEN '10010' THEN '全场成本价'
WHEN '10020' THEN '100元优惠券'
WHEN '10030' THEN '5折部分品类券'
WHEN '10040' THEN '包邮券'
WHEN '10050' THEN '一元购'
WHEN '10060' THEN '奢侈品5折购'
WHEN '10070' THEN '话费充值券'
WHEN '20010' THEN '大牌咖啡'
WHEN '20020' THEN '影音娱乐'
WHEN '20030' THEN '速食简餐'
WHEN '20040' THEN '蛋糕甜品'
WHEN '20050' THEN '城市商超'
WHEN '20060' THEN '车主服务'
WHEN '20070' THEN '迪士尼门票'
WHEN '30010' THEN '0元免费领'
WHEN '30020' THEN '免费开卡礼'
WHEN '40010' THEN '购物返5倍钢镚'
WHEN '50010' THEN '优先退换货'
ELSE rights_code
END as name
FROM member_hold_rights where user_id='15035172';
查询结果如下:
WeWork Helper20190911115952.png
网友评论