title: Update with MAX() in MySql
body: <p>The code bellow works great but... </p>
  
  <p>How can I use Update with a MAX() function in the same statement? </p>
  
  <p>Something like: UPDATE Msg SET myTime=NOW() WHERE user='username' AND myTime=max(myTimp)</p>
  
  <pre><code>SELECT @myId:=(SELECT id FROM Msg
  WHERE myTime=(SELECT MAX(myTime) FROM Msg
  WHERE user='username'));
  
  UPDATE Msq SET myTime=NOW() 
  WHERE id=@myId;
  </code></pre>