user_id date
------- ---------
1 1551867583
2 1551867580
3 1551867573
2 1551867543
2 1551867521
I have a similar table structure. What I want to do is to select records per user and select the latest one of each user's record.
Tried
GROUP BY profile_visits.user_id ORDER BY profile_visits.date DESC
This doesn't show all the latest records.
I searched and found this on StackOverflow
group by and order by in mysql query
However, that solution didn't work for me
Any idea how to solve this?