注意: balance.FBALTYPE='5' 意思是只查过账后的。 1604 包含了下级科目余额数据
客户端查询对峙数据时 筛选框条件
---按照 公司名称分组, 会计期间分组, 每个分组数据集 建立一个rownidex 便于后续取出分组后的第一条
select unit.FNAME_l2, period.fnumber , balance.FENDBALANCELOCAL, ROW_NUMBER() over(partition by unit.FNAME_l2 order by period.fnumber desc) as newIndex from T_GL_AccountBalance balance inner join T_BD_AccountView account on account.fid=balance.FACCOUNTID
inner join T_BD_Period period on period.fid=balance.FPERIODID
inner join T_ORG_BaseUnit unit on unit.fid=balance.FORGUNITID
where account.FNumber = '1604' and balance.FBALTYPE='5' and balance.FCURRENCYID='dfd38d11-00fd-1000-e000-1ebdc0a8100dDEB58FDC' --人民币