i have the following sql code that displays all records that match the user SPI-GVT97. It displays 3 results as you can see. I'd like it to show the most recent version of an instance if more than one exists. So the most recent version of summers place is 2014-03-08 and as they is only one instance of 26 friars view, that should still show. So ideally, only 2 results would show instead of the current 3. I have tried max(checkin_date)
but it just does the most recent version of everything for that client code.
SELECT checkin_id,
checkin_client_id,
checkin_inventory_id,
checkin_property_id,
checkin_date,
property_address_line_1,
client_first_name,
client_last_name,
client_organisation_name,
client_unique_id
FROM check_in
INNER JOIN properties
ON checkin_property_id = property_id
INNER JOIN clients
ON checkin_client_id = client_id
WHERE client_unique_id LIKE ?