这是看了你的答案后写的,能帮我看下我10-2号的数据哪里错了吗,自测运行都是对的,提交结果2号 的数据就不对 with t1 as (select '2021-10-01' dt,count(distinct a.product_id) ct from tb_order_detail a join tb_order_overall b on a.order_id=b.order_id join tb_product_info c on a.product_id=c.product_id where date(b.event_time) between date_sub('2021-10-01',interval 6 day) and '2021-10-01' and c.shop_id='901' union select '2021-10-02' dt,count(distinct a.product_id) ct from tb_order_detail a join tb_order_overall b on a.order_id=b.order_id join tb_product_info c on a.product_id=c.product_id where date(b.event_time) between date_sub('2021-10-02',interval 6 day) and '2021-10-02' and c.shop_id='901' union select '2021-10-03' dt,count(distinct a.product_id) ct from tb_order_detail a join tb_order_overall b on a.order_id=b.order_id join tb_product_info c on a.product_id=c.product_id where date(b.event_time) between date_sub('2021-10-03',interval 6 day) and '2021-10-03' and c.shop_id='901' ) select dt,round(ct/(select count(distinct product_id) from tb_product_info where shop_id='901'),3),round(1-ct/(select count(distinct product_id) from tb_product_info where shop_id='901'),3) from t1 order by dt;
点赞

相关推荐

不放弃的小鱼干很洒脱:好可爱的离职理由
点赞 评论 收藏
分享
牛客网
牛客企业服务