cjkenworthy
Programmer
I have a 1:M relationship between two tables A and B. If I do a join over A.id = B.id it will obviously retrieve all records from table B which join over .id with table A.
How do I have so that it only retrieves one record from B (the most recent in B based on a datetime value in B)?
A: (record_id, firstname, surname ...)
B: (message_id, record_id, dateadded ...)
so I join over A.record_id = B.record_id, but only want to return one record from B where 'dateadded' is the most recent.
How can I do this?
How do I have so that it only retrieves one record from B (the most recent in B based on a datetime value in B)?
A: (record_id, firstname, surname ...)
B: (message_id, record_id, dateadded ...)
so I join over A.record_id = B.record_id, but only want to return one record from B where 'dateadded' is the most recent.
How can I do this?