My SQL statement:
SELECT c.*, s.followup FROM clients c LEFT JOIN scans s ON c.id=s.client_id
The scans table joins to the clients table on the client_id column. The scans table can have multiple entries for each client and has a followup column containing dates. I would like to return only the scan that has the date closest to today.
When I attempted this using a WHERE condition, it eliminated items from the left table that didn't have a followup date.