是不是这个意思 With base as ( Select id, price, date lag(price)over(partition by id order by price) as prcie1, lag(date)over(partition by id order by date) as date1 From a ) Select id,max(case when price>prcie1 then datediff(date,date2) then 0 end) From base Group by id
点赞 1

相关推荐

05-01 22:41
中南大学 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客企业服务