我有 MySQL 数据库表,其结构如下所述。
uid info time
6 null 2013-04-12 23:00:00
5 something 2013-04-12 22:00:00
4 something 2013-04-10 09:00:00
3 something 2013-04-09 19:00:00
2 something 2013-04-02 10:00:00
1 something 2013-04-01 11:00:00
如何在一个 MySQL 查询中更新具有最新时间值的行?
可能的解决方案之一是
SELECT uid FROM my_table ORDER BY time DESC LIMIT 1
UPDATE my_table SET info = 'something' WHERE uid = 'uid_received_in_previuos_query'
但它是两个顺序查询解决方案......