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;
hive下1.5亿数据统计数据
最新推荐文章于 2022-11-08 14:44:54 发布