I’m trying to show a list with the last posts from each user. If I group by ID however I get the first post instead of the last. How can I group by UID and show only the row with the biggest Date?
This is what I’m trying now:
SELECT * FROM Posts GROUP BY `UID` ORDER BY `Date` DESC
Because you want the largest
Dateper user, you can use MySQL’sMAX():You can also specify it in the
HAVINGclause too: