I have a table with four columns: Note ID, Contact ID, Created By, and Created Date. I want to run a query that will return the most recent CREATED BY (i.e. "John Smith") by CONTACT ID. Contact ID, naturally, can appear multiple times in the table.
I obviously would normally run a MAX()
statement by the Created Date column, but the problem is I need to have the Contact ID & Created By present in the returned data, but I can't group by both of those columns because I would then receive multiple rows per Contact ID/Created By Grouping.
In the example below, what I would like to see returned is: 1118653/Katy Combs
, as she has the most recent CreatedOn.
ContactID Created By Created Date
1118653 Katy Combs 2020-10-19 19:58:11.687
1118653 Danielle Scarrone 2020-10-15 18:07:01.630