找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 1081|回复: 0

[技巧] 跨年跨帐套查询

[复制链接]
发表于 2022-6-30 23:36:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×
--跨帐套、跨年查询
--注意帐套、年份
--UfData_001_2010
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2010.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2010.dbo.GL_accvouch a where iperiod<>'0' order by 年份,月份,凭证号

union all
--UfData_001_2011
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2011.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2011.dbo.GL_accvouch a where iperiod<>'0' order by 年份,月份,凭证号

union all
--UfData_001_2012
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2012.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2012.dbo.GL_accvouch a where iperiod<>'0' order by 年份,月份,凭证号

union all
--UfData_001_2013
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2013.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2013.dbo.GL_accvouch a where iperiod<>'0' order by 年份,月份,凭证号

union all
--UfData_001_2014
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2014.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2014.dbo.GL_accvouch a where iperiod<>'0' order by 年份,月份,凭证号

union all
--UfData_001_2015
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_001_2015.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_001_2015.dbo.GL_accvouch a where iperiod<>'0'  order by 年份,月份,凭证号


------------------------
--UfData_002_2015
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_002_2015.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_002_2015.dbo.GL_accvouch a where iperiod='12'

union all
--UfData_002_2016
select CONVERT(varchar(4),dbill_date,120) as 年份, iperiod as 月份,ino_id as 凭证号,dbill_date as 凭证日期,cbill as 制单员,ccode as 科目编码,
(select ccode_name from UfData_002_2016.dbo.code b where  b.ccode=a.ccode)as 科目名称,
cdigest as 摘要, md as 借方, mc as 贷方 from UfData_002_2016.dbo.GL_accvouch a where iperiod<='12' and iperiod>='1'  order by 年份, iperiod,ino_id

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-11-21 22:33 , Processed in 0.063673 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表