Update with MAX() in MySql
The code bellow works great but...
How can I use Update with a MAX() function in the same statement?
Something like: UPDATE Msg SET myTime=NOW() WHERE user='username' AND myTime=max(myTimp)
SELECT @myId:=(SELECT id FROM Msg
WHERE myTime=(SELECT MAX(myTime) FROM Msg
WHERE开发者_如何学Python user='username'));
UPDATE Msq SET myTime=NOW()
WHERE id=@myId;
UPDATE Msg
SET myTime=NOW()
WHERE user='username'
ORDER BY myTime DESC
LIMIT 1
精彩评论