|
楼主 |
发表于 2009-6-3 21:55:01
|
显示全部楼层
我跟踪过程
发现语句:
insert into #Ywzb20125210585(iMonth,iDay,cdwcode,cdwname,dgst,jf_f,jf_s,jf,df_f,df_s,df) select null as imonth,null as iDay,cdwcode,cdwname,N'期初余额' as dgst,sum(case when cexch_name=N'人民币' then 0 else idamount_f end) as jf_f,sum(idamount_s) as jf_s,sum(idamount) as jf,sum(case when cexch_name=N'人民币' then 0 else icamount_f end) as df_f,sum(icamount_s) as df_s,sum(icamount) as df From Ap_DetailCust where (((bcredit=1 or idlsid<>0) and isnull(dcreditstart,dregdate)<'2009-01-01') or (isnull(bcredit,0)=0 and isnull(idlsid,0)=0 and iperiod<1 and (((dGatheringDate is null) and (ccovouchtype not in (N'26',N'27',N'28',N'29',N'EX26',N'EX27') or iperiod=0 or cprocstyle<>ccovouchtype))))) And cFlag=N'AR' and iflag<3 And cDwCode>=N'0100001' And cDwCode<=N'0100001' Group by cdwcode,cdwname Having sum(idamount - icamount) <> 0 Or sum(idamount_f - icamount_f) <> 0
减去
insert into #Ywzb20125210585(iMonth,iDay,cdwcode,cdwname,dgst,jf_f,jf_s,jf,df_f,df_s,df)
在查询分析里可看到期初,但是为什么不反映在明细帐里呢? |
|