title: MySql How to get records to show in chat conversation list
body: <p>I've single chat table as shown in the image. I want to group the chat listing like in facebook style.<img src="https://i.stack.imgur.com/FqY6G.png" alt="Table after selecting the conversations of user 2"></p>
  
  <p>Here user 2 is logged in and his conversations are selected using </p>
  
  <pre><code>SELECT * 
  FROM  `chat`  `t` 
  WHERE  `from` =2
  OR  `to` =2
  ORDER BY sent DESC
  </code></pre>
  
  <p>But here I want the latest single entry between 2 and any other user. Where 2 can be in either from or to column. As a final result it should return 2 entries with id 25 and 17 respectively.</p>