SELECT * FROM users WHERE user_id = 2 AND created_at = (SELECT max(created_at) FROM users where user_id = 2)
روش دوم با استفاده از join
select t2.* from mlm_reagent_history as t1 INNER JOIN (SELECT max(created_at) lastDate FROM mlm_reagent_history where user_id = 2) as t2 on (t1.created_at = t2.lastDate and t1.user_id = 2 )
روش سوم
SELECT * FROM user_log where user_id = 1 order by date_at DESC limit 1