这是看了你的答案后写的,能帮我看下我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;
点赞

相关推荐

每晚夜里独自颤抖:你cet6就cet6,cet4就cet4,你写个cet证书等是什么意思。专业技能快赶上项目行数,你做的这2个项目哪里能提现你有这么多技能呢
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务