楼主这样每个统计字段会加1吗.因为如果where fno=@fno  and fstyle='1'成立,则where fno=@priorfno and fstyle='1' 不成立。这样做只会把统计字段设为NULL.

解决方案 »

  1.   

    update t
    set fcount00=tb.fcount00+1
        ,fcount01=tb.fcount01+1
        ,fcount02=tb.fcount02+1
        ,fcount03=tb.fcount03+1
        ............from t_longshort_h t
    join inserted I on I.fno=t.fno
                       and t.fstyle='1'
    join t_longshort_h tb on tb.fno=I.fno-1 
                             and tb.fstyle='1'
      

  2.   


    update t
    set fcount00=tb.fcount00+1
        ,fcount01=tb.fcount01+1
        ,fcount02=tb.fcount02+1
        ,fcount03=tb.fcount03+1
        ............from t_longshort_h t,inserted I, t_longshort_h tb
    where  I.fno=t.fno and t.fstyle='1'  and tb.fno=I.fno-1   and tb.fstyle='1'