题解 | #牛客每个人最近的登录日期(二)#
牛客每个人最近的登录日期(二)
http://www.nowcoder.com/practice/7cc3c814329546e89e71bb45c805c9ad
select u.name u_n,c.name c_n,t.maxdate date
from (select user_id,max(date) maxdate
from login
group by user_id) t
join (select user_id,client_id,date from login) n
on t.maxdate = n.date and t.user_id = n.user_id
join user u
on t.user_id = u.id
join client c
on n.client_id = c.id
order by u_n asc;
好复杂....
