解决方案: |
1、需要根据末级科目更新非末级的科目的值
update gl_accsum
set mb=b.mb,me=b.me, cendd_c='借',cbegind_c='借',cbegind_c_engl='Dr',cendd_c_engl='Dr'
from gl_accsum a inner join (select iperiod,sum(mb) as mb ,sum(me) as me
from gl_accsum where ccode like '11301%' and ccode<>'11301' group by iperiod) b
on a.iperiod=b.iperiod
where a.ccode='11301'
update gl_accsum set mb=a.mb+b.mb,me=a.me+b.me
from gl_accsum a inner join (select iperiod,sum(mb) as mb ,sum(me) as me
from gl_accsum where ccode like '11301%' and ccode<>'11301' group by iperiod) b
on a.iperiod=b.iperiod
where a.ccode='113'
2、更改末级标志
update code set bend=0 where ccode='12301' |