|
修改了一下。
select *,
val(iif(借方金额 is null,0,借方金额)) as "借方",
val(iif(贷方金额 is null,0,贷方金额)) as "贷方",
iif(名称="应交税金" or 名称="其他应付款" or 名称="其他应交款" or 名称="实收资本" or 名称="本年利润",
val(iif(贷方金额 is null,0,贷方金额)) -
val(iif(借方金额 is null,0,借方金额)),
val(iif(借方金额 is null,0,借方金额)) -
val(iif(贷方金额 is null,0,贷方金额))
)as 余额
from
(
select * from [现金$a:i]
union all
select * from [银行存款$a:i]
union all
select * from [应收帐款$a:i]
union all
select * from [其他应收款$a:i]
union all
select * from [长期股权投资$a:i]
union all
select * from [待摊费用$a:i]
union all
select * from [固定资产$a:i]
union all
select * from [在建工程$a:i]
union all
select * from [其他应交款$a:i]
union all
select * from [应交税金$a:i]
union all
select * from [其他应付款$a:i]
union all
select * from [实收资本$a:i]
union all
select * from [本年利润$a:i]
union all
select * from [生产成本$a:i]
union all
select * from [制造费用$a:i]
union all
select * from [主营业务收入$a:i]
union all
select * from [主营业务成本$a:i]
union all
select * from [管理费用$a:i]
union all
select * from [财务费用$a:i]
union all
select * from [营业外支出$a:i]) |
|