更新最大值
列:
id c_id length flag_x
1 1212 30
2 1212 12
3 1212 18
4 1212 30
5 454 32
6 454 32
7 454 87
结果
id c_id length flag_x
1 1212 30 1
2 1212 12
3 1212 18
4 1212 30
5 454 32
6 454 32
7 454 87 1
------解决方案--------------------Update A Set flag_x = 1 From 表 A Where id = (Select TOP 1 id From 表 Where c_id =A.c_id Order By length Desc, id)