Try this, if you want to get the latest login for each user.
SELECT UserName, MAX([LoginDateTime]) AS LoginDateTime,
(DATEDIFF (DAY, MAX([LoginDateTime]), GETDATE ())) as [datediff]
FROM Login
GROUP BY UserName
The idea is to use GROUP BY
to group all your rows by Username, and Using MAX
aggregate function get only the row with the latest LoginDateTime, then calculate the number of days using that latest loginDateTime.