select count(a2.id, a2.date)/count(a1.id, a1.date) as avg_ret from a as a1 left outer join a as a2 on a1.id = a2.id and DATEDIFF(a2.date, a1.date)=1 where a2.date between '2021-03-01' and '2021-03-31' 最后这个日期筛选是不是这样写呀?我也不太确定,整体思路我是参考的牛客SQl入门第29题
1 5

相关推荐

ResourceUtilization:我嘞个董事长
点赞 评论 收藏
分享
牛客网
牛客企业服务