Your subject line mentions SQL, but I'm going to talk about an AwareIM approach. Assuming you need to gather the last Invoice from all of your Client BOs in one place:
1) Goal: You will store the list in a reference attribute in either SystemSettings or LoggedInSystemUser
2) Clear out the reference attribute from #1 that you use to store the invoice instances.
3) Use a process that: finds clients in batches of 1
4) Within each client, find invoices for that client sorting with most recent first ... use TAKE BEST 1
5) Insert the invoice found in #4 to the reference attribute from #1