I have a table of patients and a table of next activity dates. Each time a next activity is scheduled it adds a row with the date and the patient ID. I want to retrieve a list of patients and their newest next activity date.
So example table structures would be
1, John Doe
2, Jane Smith
id, pid, nextActivity
ID Name Next Activity
1 John Doe 11/12/2012
2 Jane Smith 11/1/2011
This is in mysql 5 access via PHP, but I don't really need help with the code just the select statement. I should really know this but I am blanking at the moment.