sql :符合某一条件时执行update

update config

set role = 'abc' 

where id = '2'  

     and (select 1 from (

             select 1 from config where role='abc' having count(1)<3

         ) t )

更新config表中id=2的role为abc  前提条件是 表中role为abc的数据小于3条的时候

猜你喜欢

转载自zhitangrui2010.iteye.com/blog/2315125
今日推荐