题解 | #牛客的课程订单分析(五)#

牛客的课程订单分析(五)

http://www.nowcoder.com/practice/348afda488554ceb922efd2f3effc427

select
b.user_id
,b.m
,a.date
,b.c
from (
select
*
,row_number() over(partition by user_id order by date) r
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')
order by user_id
) a # 将第二个时间放进去
right join (
select
user_id
,min(date) m
,count(user_id) c
from order_info
where date > '2025-10-15'
and status = 'completed'
and product_name in ('C++','Python','Java')
group by user_id
having count(user_id) >=2
order by user_id
) b #第四题的表格
on a.user_id =b.user_id
where a.r = 2
order by b.user_id

全部评论

相关推荐

双非坐过牢:非佬,可以啊10.28笔试,11.06评估11.11,11.12两面,11.19oc➕offer
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务