Avatar of LuckyLucks
LuckyLucks
 asked on

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

Hi

My mysql datatbase has row entries with two column headers :-name_of_file and date_modified.
Example:
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)
Databases

Avatar of undefined
Last Comment
Arthur_Wood

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ldbkutty

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
tromm

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
peterside7

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Arthur_Wood

No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split - {ldbkutty - #13118189}{tromm - #13119495}{peterside7 - #13120940}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Arthur_Wood
EE Cleanup Volunteer
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck