Your query is correct, with the following caveats.
It will only recall logins for as much data as there is stored in your sessions_history table. The default history period is 1 year, but this is configurable through Site Admin and may be different for your site.
Since you are joining the Users table, if any of the users for which you have history have been deleted from the Users table, then they won't be in your list.
But the part of the query that is selecting the last login time per user is correct.
It will only recall logins for as much data as there is stored in your sessions_history table. The default history period is 1 year, but this is configurable through Site Admin and may be different for your site.
Since you are joining the Users table, if any of the users for which you have history have been deleted from the Users table, then they won't be in your list.
But the part of the query that is selecting the last login time per user is correct.