SELECT user_id, MAX(date) 
from login
group by user_id
ORDER BY user_id