hive sql学习
-- 转化占比 tmk约课和总的约课在最近两个月的转化人数 select on_where, count(distinct T.fk_student) as subscribe_num_1, count(distinct if(is_attend=1,fk_student,null)) attend_num_1, count(distinct if(is_attend=1 and course_start_time<pay_end_time,stu_id,null)) zjk_num_1 from( select * from ( select fk_student,course_start_time,on_where, if(goto_class_time!=‘0‘ and is_replay!=1,1,null) is_attend from dwddb.dwd_mkt_experience_class_detail where course_start_time>="2019-08-30" AND course_start_time<=current_date() and status = 1 and dp = ‘active‘ and on_where =2) as b left join (select stu_id,pay_end_time from dwddb.dwd_trd_sales_stu_all_v1 where pay_end_time>="2019-08-30" and pay_end_time <= current_date() and course_type_first_id = 1 and return_type = 1 and stu_type_v1 !=6 and dt=regexp_replace(date_sub(current_date(),1),"-","") ) a on a.stu_id = b.fk_student where pay_end_time BETWEEN course_start_time and DATE_add(course_start_time, 15) ) T group by on_where
相关推荐
archive 2020-07-30
成长之路 2020-07-28
eternityzzy 2020-07-19
taisenki 2020-07-05
tugangkai 2020-07-05
SignalDu 2020-07-05
zlsdmx 2020-07-05
tomson 2020-07-05
tugangkai 2020-07-04
tomson 2020-07-05
Zhangdragonfly 2020-06-28
genshengxiao 2020-06-26
成长之路 2020-06-26
tomson 2020-06-26
蜗牛之窝 2020-06-26
成长之路 2020-06-25