hive下1.5亿数据统计数据

select
  g.inc_day,
  count(
    case
      when g.position_attr in ('一线', '二线') then g.emp_code
    end
  ) as one_two_total,
  count(
    case
      when g.position_attr = '三线' THEN g.emp_code
    end
  ) as three_total,
  count(
    case
      when g.position_attr = 'LOST_POS_ATTR_M' THEN g.emp_code
    end
  ) as lost_pos,
  count(g.emp_code) as full_total
from
  (
    SELECT
      a.inc_day,
      if(
        b.position_attr is null,
        'LOST_POS_ATTR_M',
        b.position_attr
      ) as position_attr,
      a.emp_code
    FROM
      ods_hrssgps.tt_clock_log a
      LEFT JOIN gdl.tt_emp_info b on(
        b.emp_code = a.emp_code
        and b.inc_day = a.inc_day
      )
    where
      a.RESERVE3 IN ('100', '200', '300')
      and a.inc_day >= '20190101'
      and b.inc_day <= '20190701'
  ) g
group by
  g.inc_day;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值