mysql join table - selecting the newest row
- by cmancre
Hi,
I have the following two MySQL tables
TABLE NAMES
NAME_ID NAME
1 name1
2 name2
3 name3
TABLE STATUS
STATUS_ID NAME_ID TIMESTAMP
1 1 2010-12-20 12:00
2 2 2010-12-20 10:00
3 3 2010-12-20 10:30
4 3 2010-12-20 14:00
I would like to select all info from table NAMES and add most recent correspondent TIMESTAMP column from table STATUS
RESULT
NAME_ID NAME TIMESTAMP
1 name1 2010-12-20 12:00
2 name2 2010-12-20 10:00
3 name3 2010-12-20 14:00
Am stuck on this one.
How do I left join only on the newer timestamp?