其他分享
首页 > 其他分享> > U8 查询现金流量表和凭证表里金额对应不上的凭证

U8 查询现金流量表和凭证表里金额对应不上的凭证

作者:互联网

select * from GL_CashTable where iyear = '2020'   and iPeriod = '9' and iNo_id=82


select * from gl_accvouch where iyear = '2020'   and iPeriod = '9'


-- 查询金额不同对应的的凭证号1
select ca.ino_id,(ca.md +ca.mc ),(gl.md+gl.mc )
from GL_CashTable ca
left join gl_accvouch gl on ca.iNo_id=gl.ino_id and ca.inid=gl.inid and ca.iyear=gl.iyear  and gl.iperiod=ca.iPeriod
where ca.iyear='2022' and ca.iPeriod=7
and (ca.md +ca.mc )<>(gl.md+gl.mc )



-- 查询金额不同的凭证号2
select distinct ino_id into tempdb..bbb from gl_accvouch 
where ino_id in (
select iNo_id from GL_CashTable where iperiod=7 and iyear='2022')
and iperiod=7 and iyear='2022'
--and left(ccode,4) in('1001','1002','1101')


select distinct ino_id into tempdb..aa from GL_CashTable where iyear = '2022'   and iPeriod = '7'

select ino_id from  tempdb..aa where ino_id not in (select ino_id from tempdb..bbb)



--备份
select * into GL_CashTable_202208030533_bak from GL_CashTable 

-- 查询并删除现金流量表数据
select * --delete from  GL_CashTable where  iperiod=7 and iyear='2022' and  ino_id in (select ino_id from  tempdb..aa where ino_id not in (select ino_id from tempdb..bbb)
)

 

标签:凭证,U8,ca,不上,ino,iyear,gl,id,select
来源: https://www.cnblogs.com/xiaobaidejiucuoben/p/16548198.html