首页 > 代码库 > case when then用法
case when then用法
--简单Case函数 CASE sex WHEN ‘1‘ THEN ‘男‘ WHEN ‘2‘ THEN ‘女‘ ELSE ‘其他‘ END
//案例 select cid as 渠道编号, case cid when ‘3‘ then ‘华为‘ when ‘20645‘ then ‘小米‘ else cid end as 渠道名称, //别名 渠道名称,遇见3表示华为渠道,遇到20645表示小米渠道 intdate as 注册日期, install as 激活人数, reg2 as 注册人数, concat( left(reg2 / install *100, 5), ‘%‘) as 注册率, ip as 去重IP数, device as 去重设备数, charge_user as 充值人数, charge_times as 充值次数, charge_money as 充值面额, charge_money2 as 新增充值面额, concat( left(day1 / reg2 *100, 5), ‘%‘) as 次日留存率, concat( left(day2 / reg2 *100, 5), ‘%‘) as 2日留存率, concat( left(day3/ reg2 *100, 5), ‘%‘) as 3日留存率, concat( left(day4 / reg2 *100, 5), ‘%‘) as 4日留存率, concat( left(day5 / reg2 *100, 5), ‘%‘) as 5日留存率, concat( left(day6 / reg2 *100, 5), ‘%‘) as 6日留存率, concat( left(day7 / reg2 *100, 5), ‘%‘) as 7日留存率 from union_data where intdate>= ‘20161020‘ and intdate<= ‘20161031‘
case when then用法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。