title: How to do a left join in Core Data?
body: <p>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.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/1313120/retrieving-the-last-record-in-each-group">an answer</a> for an SQL query that I've tried on the sqlite file:</p>
  
  <pre><code>SELECT m1.* FROM ZMMESSAGE m1 LEFT JOIN ZMMESSAGE m2 
  ON (m1.ZINTERLOCUTORUSERNAME = m2.ZINTERLOCUTORUSERNAME AND m1.ZSENTAT &lt; m2.ZSENTAT) 
  WHERE m2.ZSENTAT IS NULL;
  </code></pre>
  
  <p>The query gives me the expected records, but how can I make an NSFetctRequest that does the same?</p>
  
  <p>My entitiy is as follows:</p>
  
  <p><img src="https://i.stack.imgur.com/yausy.png" alt="enter image description here"></p>