(select u.name u_n,c.name c_n,l.date d,max(l.date) over(partition by l.user_id) aa
from login l join user u on l.user_id = u.id join client c on l.client_id=c.id
order by u.name) f
where f.aa = f.d

(select u.name u_n,c.name c_n,l.date d,max(l.date) over(partition by l.user_id) aa
from login l join user u on l.user_id = u.id join client c on l.client_id=c.id
order by u.name) f
where f.aa = f.d