select 
x.u_n,
x.c_n,
x.date
from
(SELECT
u.name as u_n,
c.name as c_n,
l.date,
row_number()over(PARTITION by u.name order by l.date desc)mm
FROM login l
LEFT JOIN user u on u.id =l.user_id
left JOIN client c on c.id =l.client_id)x
WHERE x.mm =1