可以这样编写SQL 更新查询:
update tblName set C=2 where exists (select 1 from (select A,max(B) as B from tblname group by A having sum(C)=1)t where tblName.A=t.A and tblName.B=t.B);