In my iOS messaging app, I'd like to display a list of the newest messages a user have with his interlocutors. In other words, this view is an overview of all chats.
I found an answer for an SQL query that I've tried on the sqlite file:
SELECT m1.* FROM ZMMESSAGE m1 LEFT JOIN ZMMESSAGE m2
ON (m1.ZINTERLOCUTORUSERNAME = m2.ZINTERLOCUTORUSERNAME AND m1.ZSENTAT < m2.ZSENTAT)
WHERE m2.ZSENTAT IS NULL;
The query gives me the expected records, but how can I make an NSFetctRequest that does the same?
My entitiy is as follows: