注册账号 登录
用友之家-用友软件论坛 返回首页

用友软件007的个人空间 https://www.oyonyou.com/?265061 [收藏] [复制] [分享] [RSS]

日志

用友通整理现存量sql语句

已有 475 次阅读2013-7-5 14:35 | sql语句, 用友通

if exists (select * from tempdb..sysobjects where type='u' and name='forcurrentsyz')
drop table tempdb..forcurrentsyz
go
select cwhcode,cinvcode,sum(iquantity) as iquantity into tempdb..forcurrentsyz from (
select cwhcode,cinvcode,iaInquantity as iquantity from ia_subsidiary where cvoutype='34'
union all
select cwhcode,cinvcode,( case when brdflag=1 then iquantity else -1*(iquantity) end) as iquantity
from rdrecord left join rdrecords on rdrecord.id=rdrecords.id ) a
group by cwhcode,cinvcode
go
delete from currentstock
Go
insert into currentstock (cwhcode,cinvcode,iquantity) select cwhcode,cinvcode,iquantity from tempdb..forcurrentsyz
go

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册账号

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

GMT+8, 2024-5-29 22:56 , Processed in 0.025735 second(s), 12 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部