请教一条sql语句!
table test:
t_name id flag
aaa 1 1
aaa 2 1
aaa 3 0
aaa 4 0
更新flag=0
条件:t_name= 'aaa ',flag=0,min(id)
结果:
aaa 1 1
aaa 2 1
aaa 3 1
aaa 4 0
------解决方案--------------------update test set flag=1 where t_name= 'aaa ' and flag = 0 and id in(select min(id) from test);