有一组数据select archiveid, filetime, filename , status
from file_table
order by filename ASC;
+-----------+---------------------+----------+--------+
| id| filetime| filename | status |
+-----------+---------------------+----------+--------+
|         1 | 2014-05-21 01:24:24 | c1.txt   |      1 |
|         8 | 2014-05-23 01:24:24 | c1.txt   |      1 |
|        10 | 2014-05-21 04:24:26 | c2.txt   |      1 |
|         2 | 2014-05-21 01:24:25 | c3.txt   |      1 |
|         9 | 2014-05-21 02:24:25 | c3.txt   |      1 |
|         3 | 2014-05-21 01:24:26 | c4.txt   |      1 |
|         5 | 2014-05-21 03:24:26 | c4.txt   |      1 |
|         6 | 2014-05-21 05:24:26 | c4.txt   |      1 |
|         7 | 2014-05-22 01:24:26 | c4.txt   |      1 |
+-----------+---------------------+----------+--------+数据库file_table表有4组文件,c1 ~ c4.txt,录入的时间filetime列不一样,每组文件将最大时间的status位设置成3。 求查询语句。期待结果+-----------+---------------------+----------+--------+
| id| filetime| filename | status |
+-----------+---------------------+----------+--------+
|         1 | 2014-05-21 01:24:24 | c1.txt   |      1 |
|         8 | 2014-05-23 01:24:24 | c1.txt   |      3 |
|        10 | 2014-05-21 04:24:26 | c2.txt   |      3 |
|         2 | 2014-05-21 01:24:25 | c3.txt   |      1 |
|         9 | 2014-05-21 02:24:25 | c3.txt   |      3 |
|         3 | 2014-05-21 01:24:26 | c4.txt   |      1 |
|         5 | 2014-05-21 03:24:26 | c4.txt   |      1 |
|         6 | 2014-05-21 05:24:26 | c4.txt   |      1 |
|         7 | 2014-05-22 01:24:26 | c4.txt   |      3 |
+-----------+---------------------+----------+--------+