select id from (select *,sum(case when datediff(date-lag_date)<=1 and rate>=0.5 and lag_rate>=0.5 then 0 else 1                   end) over(partiton by id rows between unbounded preceding and current row) as s   from (select id,date,rate,            lag(date,1,null) over(partition by id order by date) as lag_date,            lag(rate,1,null) over(partition by id order by date) as lag_rate            from table)a )tab group by id,s having count(1)>=3
点赞 评论

相关推荐

什么时候才能有offer啊_:十年前我还在刺激战场研究跳伞的底层原理呢
投递牛客等公司10个岗位
点赞 评论 收藏
分享
01-24 12:50
门头沟学院 C++
投票
菜狗二号:还有啥想的 指定国有行啊,去了就开始幸福美满的生活了,选华子不是折腾自己么,最终财富积累度是差不多的,但是幸福指数是相差甚远的
点赞 评论 收藏
分享
牛客网
牛客企业服务