salesforce – Getting the latest entry for every client in SOQL

I am trying to write a SOQL query to get the latest entry for every client from a custom object.

The closest I have been able to find is this (from SQL, not SOQL). Do you know if this is possible in SOQL?

SELECT Id,
       Score__c,
       Client__c,
       Date__c
FROM my_custom_object__c mco1
WHERE CreatedDate = (SELECT MAX(mco1.CreatedDate) FROM my_custom_object__c mco2 where mco1.id = mco2.id)

It is of course possible I am completely barking up the wrong tree. Any help would be greatly appreciated.

Read more here: Source link