|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
--总帐现金、银行
select * from GL_accvouch where (ccode like '1001%' or ccode like '1002%') and (iperiod between '1' and '12') and idoc='-1'
---------------
--现金流量表项目描述及凭证描述(003帐套2016年)
select a.*,
(select citemname from ufdata_003_2016.dbo.fitemss98 b where a.ccashitem=b.citemcode) as citemnm,
(select cdigest from ufdata_003_2016.dbo.GL_accvouch c where a.iperiod=c.iperiod and a.ino_id=c.ino_id and a.inid=c.inid)as para_drpt
from ufdata_003_2016.dbo.GL_cashtable a order by a.iperiod,a.ino_id
union all --联合查询
--现金流量表项目描述及凭证描述(003帐套2015年)
select a.*,
(select citemname from ufdata_003_2015.dbo.fitemss98 b where a.ccashitem=b.citemcode) as citemnm,
(select cdigest from ufdata_003_2015.dbo.GL_accvouch c where a.iperiod=c.iperiod and a.ino_id=c.ino_id and a.inid=c.inid)as para_drpt
from ufdata_003_2015.dbo.GL_cashtable a order by a.iperiod,a.ino_id
union all --联合查询
--现金流量表项目描述及凭证描述(003帐套2014年)
select a.*,
(select citemname from ufdata_003_2014.dbo.fitemss98 b where a.ccashitem=b.citemcode) as citemnm,
(select cdigest from ufdata_003_2014.dbo.GL_accvouch c where a.iperiod=c.iperiod and a.ino_id=c.ino_id and a.inid=c.inid)as para_drpt
from ufdata_003_2014.dbo.GL_cashtable a order by a.iperiod,a.ino_id
--数据库前加服务器可跨服务器查询
--------------
--三库不同机联合查询总帐
select * from machinenamea.ufdata_104_2014.dbo.GL_accvouch
union all
select * from machinenamea.ufdata_104_2015.dbo.GL_accvouch
union all
select * from machinenamea.ufdata_104_2016.dbo.GL_accvouch
--下两句总帐查询结果相同(003帐套2016年1-12月份,不包括月末结转利润)
select * from ufdata_003_2016.dbo.GL_accvouch where (iperiod between '1' and '12') and idoc='-1'
select * from ufdata_003_2016.dbo.GL_accvouch where iperiod>='1' and iperiod<='12' and idoc='-1'
|
|