|
|

楼主 |
发表于 2011/9/28 17:07:02
|
显示全部楼层
select fds.asset_id,
fdh.units_assigned, --当前ASSETS数量
fab.current_units, --该ASSET_ID 的现存总数量
fds.YTD_DEPRN, --年度累计折旧
gcc.segment2 --部门别CODE
from fa.fa_deprn_summary fds,
fa.fa_deprn_periods fdp,
fa.fa_distribution_history fdh,
fa.fa_additions_b fab,
gl.gl_code_combinations gcc
where fdp.PERIOD_NAME = 'DEC-03' --定义期间为12月份
and fdp.PERIOD_COUNTER = fds.PERIOD_COUNTER
and fds.asset_id = fdh.asset_id
and fds.asset_id = fab.asset_id
and fdh.code_combination_id = gcc.code_combination_id
and fdh.date_ineffective is null --资产转移之前的行排除
select gcc.segment2, --部门别CODE
sum(fds.YTD_DEPRN*fdh.units_assigned/fab.current_units) as YTD_Deprn --年度累计折旧
from fa.fa_deprn_summary fds,
fa.fa_deprn_periods fdp,
fa.fa_distribution_history fdh,
fa.fa_additions_b fab,
gl.gl_code_combinations gcc
where fdp.PERIOD_NAME = 'DEC-03' --定义期间为12月份
and fdp.PERIOD_COUNTER = fds.PERIOD_COUNTER
and fds.asset_id = fdh.asset_id
and fds.asset_id = fab.asset_id
and fdh.code_combination_id = gcc.code_combination_id
and fdh.date_ineffective is null --资产转移之前的行排除
group by gcc.segment2 |
|