I'm relatively new to SQL and I have the following query to get a list of logins since Jan 1st. I'm trying to only display each user's last login.
SELECT usrlogs.serverlogintime AS Login_Date,
usrlogs.usrname AS User_Name,
usrlogs.usrid AS User_ID,
usrlogs.usrlogid AS Log_ID,
users.status AS Active
FROM usrlogs
INNER JOIN users
ON usrid = uid
WHERE DATE_FORMAT (ServerLoginTime,'%Y-%m-%d') >= '2022-01-01' and status="0"
User_Log_ID increases by 1 with each new login to the server. Is there a way to only display each user's highest Log ID?