I have in the table 30 records with the same Title but different Ids and dates each one. How to return in the query de most recent by date?
The table looks like this:
Id - Title - Date
-----------------
1 - africa - 2012-11-27
2 - africa - 2012-11-26
3 - africa - 2012-11-25
I need a query that returns the record which Id is 3, that is the most recent by the date. All I’ve tried until now using GROUP BY is only returning the record wich Id is 1. How can I do that?
You want to get the first record but that is not the recent. The idea behind the subquery is that it gets the first date for each title and joined it against itself provided that it match the title and the date.