1:update 时做检查使用
update mw_contract set payTimes = ( case when payTimes > 0 then payTimes - 1 else payTimes end ) where contractNo = ' 2015001 ' ; 2:select时使用 select case when payTimes > 0 then payTimes - 1 else payTimes end payTimes from mw_contract;