用一条语句试试
 update 表 set 数据=(case 数据 when 1 or 5 then 数据
                     else (select 数据 from 表 aa 
                           where cast(replace(a.时间,'时','') as int)
                                -cast(replace(时间,'时','') as int)=1
                          ) - 数据 
                     end 
                    )