troubleshooting Question

Getting the most current(date-wise) record from mysql database

Avatar of LuckyLucks
LuckyLucks asked on
4 Comments3 Solutions1563 ViewsLast Modified:

My mysql datatbase has row entries with two column headers :-name_of_file and date_modified.
name_of_file  date_modified
pooh.txt         2004-12-04
piglet.txt        2005-01-03
pooh.txt        2005-01-01

Note that pooh.txt is the same file but we have two row entries for it. This is because everytime we modify the file , there is an entry for it in the database with the modified date.

Is there a way i can select rows such that if a file appears more than once, i can select the row containing the most "up-to-date"/recent date?

For example, how can I get the output below?
name_of_file  date_modified
piglet.txt        2005-01-03
pooh.txt        2005-01-01 (We ignored "pooh.txt   2004-12-04" as the date 2005-01-01 is more recent than 2004-12-04)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros