窗口窗口

select u.name u_n,c.name c_n,date
from (select *,rank()over(partition by user_id order by date desc) r from login) a
join user u on a.user_id=u.id
join client c on a.client_id=c.id
where a.r=1
order by u_n