How to group by unique user ID and sort by latest messages ID? : <p>my message table</p>

<pre><code>message_id | message_body_content | sender_user_id | receiver_user_id
1          | hello world          | 1000           | 1200
2          | hello world 2        | 1001           | 1200
3          | hello world again    | 1000           | 1200
4          | xyz                  | 1001           | 1200
5          | abc                  | 1200           | 1999
</code></pre>

<p>I want to group by my <code>message</code> table by <code>sender_user_id</code> unique and by last <code>message_id</code></p>

<p>so output should be like;</p>

<pre><code>message_id | message_body_content | sender_user_id | receiver_user_id
3          | hello world again    | 1000           | 1200
4          | xyz                  | 1001           | 1200
</code></pre>

<p>Because latest <code>message_id</code> for <code>sender_user_id</code> IS 3. This is in theory.</p>

<p>When I try</p>

<pre><code>SELECT * FROM message WHERE receiver_user_id = 1200 
GROUP BY sender_user_id
ORDER BY message_id DESC
</code></pre>

<p>It did not work. Because MySQL grouping first by <code>message_id</code> (min message_id value)</p>

<p>then sorting.</p>

<p>How can I get unique sender message by max <code>message_id</code></p>
