服务热线:022-26677809 , 13821206318
坚守“用户之友”的初心,做“专业的奋斗者”,始终坚持“持续创新”
首页 > 知识库 > 正文

重新计算每个月的年初原值、月初原值、月末原值

- 浏览:1442 - 发布时间:2008-04-29 10:37:00.0
问题版本: 810-U6普及版3.1 问题模块: 3-固定资产
所属行业: 0-通用 问题状态: 1-UU通注册用户
关 键 字: 重写固定资产关键字段 适用产品:
补 丁 号: 开放状态: 0-UU通注册用户
原问题号: 提交时间: 2008-4-29 10:37:00
问题名称: 重新计算每个月的年初原值、月初原值、月末原值
问题现象: 如何利用语句重新计算每个月的年初原值、月初原值、月末原值
原因分析: update fa_total set dblyearvalue = '年初原值' where sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = dblyearvalue where iperiod = '1' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '1' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '2' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '2' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '3' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '3' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '4' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from f
解决方案: update fa_total set dblyearvalue = '年初原值' where sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = dblyearvalue where iperiod = '1' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '1' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '2' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '2' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '3' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '3' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '4' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '4' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '5' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '5' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '6' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '6' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '7' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '7' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '8' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '8' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '9' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '9' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '10' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '10' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '11' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblmonthvalue = x.dblvalue from (select dblvalue from fa_total where iperiod = '11' and sdeptnum = '部门编码' and stypenum = '资产编码')as x where iperiod = '12' and sdeptnum = '部门编码' and stypenum = '资产编码' update fa_total set dblvalue = dblmonthvalue - dbldecvalue +dbladdvalue