Here, adapt this to your tables. Took me like 2 minutes, I do it waaaay too often.
N1 is a group no matter and make sure you have max (id), you can use recno () to create correctly sorted
N2 - joins N1, where ID = Max Id from N1, displays the field you want from N2
Then, if you want to join other tables, put it all in brackets and give it an alias and include it in the join.
Select N1.reference, N1.OrderNoteCount, N2.notes_desc LastNote FROM (select reference, count(reference) OrderNoteCount, Max(notes_key) MaxNoteId from custnote where reference != '' Group by reference ) N1 JOIN ( select reference, count(reference) OrderNoteCount, notes_key, notes_desc from custnote where reference != '' Group by reference, notes_key, notes_desc ) N2 ON N1.MaxNoteId = N2.notes_key
source share