title: mysql: Get last conversation records by user
body: <p>I need to get last conversation records by to_user in Descending order.
  I have table called messages. Please have a look on the following screen shot:
  <a href="https://i.stack.imgur.com/ymh7V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ymh7V.png" alt="enter image description here"></a></p>
  
  <p>I want the output in the following manner:</p>
  
  <pre><code> from_user| to_user | message         | 
    241     |  226    |   How are you?  |
    241     |  256    | Hi test message |
  </code></pre>
  
  <p>I have tried this query:</p>
  
  <pre><code>SELECT * FROM `messages` where from_user=241 group by to_user order by created DESC
  </code></pre>
  
  <p><strong>I am getting the following output which is wrong:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/JkBpx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JkBpx.png" alt="enter image description here"></a></p>
  
  <p>Thanks in advance.</p>