select
    user_id,
    max(date) as id
from
    login
group by
    user_id
order by
    user_id asc