I would like to retrieve all records having the most recent modification time.
For example, taking this table:
|page_url|last_modified|
---------
|abc.com |2010-10-01 10:00:00|
|xyz.com |2010-10-04 12:10:00|
|xyz.com |2010-10-04 12:00:00|
|xyz.com |2010-10-04 10:00:00|
|abc.com |2010-10-01 08:00:00|
And output should contain following data:
|page_url|last_modified|
---------
|abc.com |2010-10-01 10:00:00|
|xyz.com |2010-10-04 12:10:00|
I have tried using having clause like below but not working for me 🙁
SELECT page_url, last_modified
FROM
my_table
HAVING MAX(last_modified);
Edit 1 : I am having 25 fields in my table to use. But, I guess I can’t apply group by for all. What to do now?
No need to use
HAVINGon this, onlyGROUP BYclause.UPDATE 1