In MySQL query, I wanted to query a list of recent login 1 user information form each user type.
Table Information: user table has columns: user_id, usertype_id, last_login_date usertype table has columns: usertype_id, user_id
I have tried,
SELECT MAX(u.last_login_date), u.user_id FROM `user` u
JOIN usertype ut ON u.usertye_id = ut.usertype_id
GROUP BY ut.usertype_id;
But the above query returns 'last_login_date' irrespective of the user_id. Any ideas will be appreciated.