zpy2 发表于 2022-3-24 17:50
什么样的明细账?
全是乱码?
create temp table aa as select 账户名称||月 序,*,(sum(借方金额-贷方金额) over (partition by 账户名称 order by rowid)) 借方余额 from excel多表合并汇总表; create temp table bb as select 账户名称||月||'b' 序,月,' ' 日,' ' 种类,' ' 号数,'本期小计' 摘要,账户名称,sum(借方金额) 借方金额,sum(贷方金额) 贷方金额,'' 借方余额 from excel多表合并汇总表 group by 账户名称,月; create temp table cc as select 账户名称||月||'c' 序,月,' ' 日,' ' 种类,' ' 号数,'本期累计' 摘要,' ' 账户名称,(sum(借方金额) over (partition by 账户名称 order by rowid)) 借方金额,(sum(借方金额) over (partition by 账户名称 order by rowid)) 贷方金额,'' 借方余额 from bb; create temp table dd as select 序,月,日,种类,号数,摘要,账户名称,借方金额,贷方金额,借方余额 from aa union select 序,月,日,种类,号数,摘要,账户名称,借方金额,贷方金额,借方余额 from bb union select 序,月,日,种类,号数,摘要,账户名称,借方金额,贷方金额,借方余额 from cc ; select 月,日,种类,号数,摘要,账户名称,借方金额,贷方金额,借方余额 from dd where 账户名称 like '%开发成本_电费%' order by 序 COLLATE NATURAL_CMP; |