Link to home
Start Free TrialLog in
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)
ASKER CERTIFIED SOLUTION
Avatar of ldbkutty
ldbkutty
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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