题解 | 牛客每个人最近的登录日期(二)
牛客每个人最近的登录日期(二)
https://www.nowcoder.com/practice/7cc3c814329546e89e71bb45c805c9ad
select
u_n,
c_n,
latest_date date
from
(
select
b.name u_n,
c.name c_n,
date,
last_value(date) over (
partition by
user_id
order by
date rows between unbounded preceding
and unbounded following
) latest_date
from
login a
join user b on a.user_id = b.id
join client c on a.client_id = c.id
) t1
where
date = latest_date
order by
1
查看8道真题和解析