select user_id, max(date) id
from login
group by user_id
order by user_id
  • 考察group by
  • 注意最近日期用max