Show latest occurrence in get_entities

I am trying to show the latest occurrence when I get entities.  Example would be a message inbox.  I only want to show the latest message from each user in the inbox.

I asked the question here:

https://stackoverflow.com/questions/47174214/sql-return-latest-occurrence