表A
  id  state flag
  1    4     N
  2    4     Yupdate 此表的时候 ,如果 flag为N则 update set state='0' where id='id'
如果 flag 为Y,则 update set state='1' where id='id'得到结果 id state flag
 1   0     N
 2   1     Y求sql