select to_date(substr(t20.EVENT_TIME1,1,9),'YYYY/MM/DD'), round(count(distinct t20.PRODUCT_ID) / (select count( distinct PRODUCT_ID) from tb_product_info),3) to11, 1- round(count(distinct t20.PRODUCT_ID) / (select count( distinct PRODUCT_ID) from tb_product_info),3) to12 from ( select t1.EVENT_TIME EVENT_TIME1,t2.* from ( select t1.* ,t2.event_time from tb_order_detail t1 left join tb_order_overall t2 on t1.order_id=t2.order_id where to_date(EVENT_TIME,'YYYY/MM/DD hh24:mi:ss') between date'2021-10-1' and date'2021-10-4' ) t1 left join (select t1.* ,t2.event_time from tb_order_detail t1 left join tb_order_overall t2 on t1.order_id=t2.order_id ) t2 on 1=1 and to_date(t2.EVENT_TIME,'YYYY/MM/DD hh24:mi:ss') >= to_date(substr(t1.EVENT_TIME,1,9),'YYYY/MM/DD') -5 and to_date(t2.EVENT_TIME,'YYYY/MM/DD hh24:mi:ss') <= to_date(substr(t1.EVENT_TIME,1,9),'YYYY/MM/DD') +1 ) t20 group by to_date(substr(t20.EVENT_TIME1,1,9),'YYYY/MM/DD') order by to_date(substr(t20.EVENT_TIME1,1,9),'YYYY/MM/DD')
点赞

相关推荐

10-16 15:48
算法工程师
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务