找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

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

[求助] 现存量查时所用到的SQL语句是怎样的?

[复制链接]
发表于 2008-6-4 11:38:31 | 显示全部楼层
看着眼晕
发表于 2008-6-4 11:41:03 | 显示全部楼层
先收藏,再慢慢研究
发表于 2008-6-4 13:26:46 | 显示全部楼层
太历害了,高手高手高高手。
发表于 2008-6-4 14:25:35 | 显示全部楼层
太强了.................
发表于 2008-6-6 11:06:25 | 显示全部楼层

高手,学习....

高手,学习....
发表于 2008-6-6 15:47:08 | 显示全部楼层
2#的代码也太~~~~~~~~~
不知道对不
发表于 2008-6-6 16:19:50 | 显示全部楼层
看不懂
发表于 2008-9-17 23:51:59 | 显示全部楼层
厉害!啊 留着研究一下
发表于 2008-9-27 16:37:28 | 显示全部楼层
select
a.cInvCode as 存货编码,a.cInvName as 存货名称,a.cInvStd as 规格型号,b.cComUnitName as 主计量单位,a.iSafeNum as 安全库存量,c.iQuantity as 可用量,(c.iQuantity-a.iSafeNum) as 差量
,d.cWhName as 仓库
from
Inventory a,
ComputationUnit b,
CurrentStock c,
Warehouse d
where 1=1
and a.cInvCode = c.cInvCode
and a.cComunitCode = b.cComunitCode
and c.cWhCode = d.cWhCode
发表于 2010-4-16 13:50:11 | 显示全部楼层
SQL语句:SELECT '002' as 帐套, W.cWhCode, W.cWhName, I.cInvCode, I.cInvAddCode,I.cInvName, I.cInvStd, I.cInvCCode , IC.cInvCName,  CU_M.cComUnitName AS cInvM_Unit, CASE WHEN I.iGroupType = 0 THEN NULLWHEN I.iGrouptype = 2 THEN CU_A.cComUnitNameWHEN I.iGrouptype = 1 THEN CU_G.cComUnitName ENDAS cInvA_Unit,CASE WHEN I.iGroupType = 0 THEN NULL  WHEN I.iGroupType = 2 THEN (CASE WHEN CS.iQuantity = 0.0 OR CS.iNum = 0.0 THEN NULL ELSE CS.iQuantity/CS.iNum END)  WHEN I.iGroupType = 1 THEN CU_G.iChangRate END AS iExchRate,i.cInvDefine1,i.cInvDefine2,i.cInvDefine3,i.cInvDefine4,i.cInvDefine5,i.cInvDefine6,i.cInvDefine7,i.cInvDefine8,CS.cFree1,CS.cFree2,CS.cFree3, Null as cFree4, Null as cFree5, Null as cFree6, Null as cFree7, Null as cFree8, Null as cFree9, Null as cFree10, Null as cInvDefine9, Null as cInvDefine10, Null as cInvDefine11, Null as cInvDefine12, Null as cInvDefine13, Null as cInvDefine14, Null as cInvDefine15, Null as cInvDefine16,cs.cBatch, cs.EnumName As iSoTypeName, cs.csocode as SOCode, convert(nvarchar,cs.isoseq) as iRowNo,cs.cvmivencode,v1.cvenabbname as cvmivenname , isnull(E.enumname,N'') as cMassUnitName,CS.dVDate, CS.dMdate,CS.iMassDate, (iQuantity) AS iQtty,( CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(iNum,0) WHEN iGroupType = 1 THEN iQuantity/ CU_G.iChangRate END) AS iNum,CASE WHEN CS.bStopFlag = 1 OR CS.bGspStop = 1 THEN iQuantity ELSE IsNull(fStopQuantity,0) END AS iStopQtty,CASE WHEN CS.bStopFlag = 1 OR CS.bGspStop = 1 THEN (CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(iNum,0) WHEN iGroupType = 1 THEN iQuantity/ CU_G.iChangRate END)  ELSE (CASE WHEN iGroupType = 0 THEN 0 WHEN iGroupType = 2 THEN ISNULL(fStopNum,0) WHEN iGroupType = 1 THEN fStopQuantity/ CU_G.iChangRate END) END AS iStopNum, (fInQuantity) AS fInQtty,  (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fInNum,0) WHEN iGroupType = 1 THEN fInQuantity/ CU_G.iChangRate END) AS fInNum, (fTransInQuantity) AS fTransInQtty, (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fTransInNum,0) WHEN iGroupType = 1 THEN fTransInQuantity/ CU_G.iChangRate END) AS fTransInNum, (ISNULL(fInQuantity,0)   ISNULL(fTransInQuantity,0)) AS fInQttySum, (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fInNum,0)   ISNULL(fTransInNum,0) WHEN iGroupType = 1 THEN (ISNULL(fInQuantity,0)   ISNULL(fTransInNum,0))/ CU_G.iChangRate END) AS fInNumSum, (fOutQuantity) AS fOutQtty,  (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fOutNum,0) WHEN iGroupType = 1 THEN fOutQuantity/ CU_G.iChangRate END) AS fOutNum, (fTransOutQuantity) AS fTransOutQtty,  (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fTransOutNum,0) WHEN iGroupType = 1 THEN fTransOutQuantity/ CU_G.iChangRate END) AS fTransOutNum, (ISNULL(fOutQuantity,0)   ISNULL(fTransOutQuantity,0)) AS fOutQttySum ,  (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fOutNum,0)   ISNULL(fTransOutNum,0) WHEN iGroupType = 1 THEN (ISNULL(fOutQuantity,0)   ISNULL(fTransOutNum,0))/ CU_G.iChangRate END) AS fOutNumSum, (fDisableQuantity) AS fDisableQtty,  (CASE WHEN iGroupType = 0 THEN NULL WHEN iGroupType=2 THEN ISNULL(fDisableNum,0) WHEN iGroupType = 1 THEN fDisableQuantity/ CU_G.iChangRate END) AS fDisableNum, (CASE WHEN bInvBatch=1 THENCASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) ELSECASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) END) AS fAvailQtty,  (CASE WHEN iGroupType = 0 THEN 0WHEN iGroupType = 2 THENCASE WHEN bInvBatch=1 THENCASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iNum,0) - IsNull(fStopNum,0) END  ISNULL(fInNum,0) - ISNULL(fOutNum,0) ELSECASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iNum,0) - IsNull(fStopNum,0) END  ISNULL(fInNum,0) - ISNULL(fOutNum,0) END WHEN iGroupType = 1 THEN(CASE WHEN bInvBatch=1 THENCASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) ELSECASE WHEN bStopFlag =1 OR bGSPStop= 1 THEN 0 ELSE ISNULL(iQuantity,0) - IsNull(fStopQuantity,0) END  ISNULL(fInQuantity,0) - ISNULL(fOutQuantity,0) END)/CU_G.iChangRate ELSE NULL END) AS fAvailNum-- INTO tempdb..TMPUF_171085006_heron525795190_WZUF FROM v_CurrentStock CS inner join ufdata_002_2008..Inventory I ON I.cInvCode = CS.cInvCode  left join ufdata_002_2008..InventoryClass IC ON IC.cInvCCode = I.cInvCCode LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_G ON  I.cSTComUnitCode =CU_G.cComUnitCode  LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_A ON I.cAssComUnitCode = CU_A.cComunitCode  LEFT OUTER JOIN ufdata_002_2008..ComputationUnit CU_M ON I.cComUnitCode = CU_M.cComunitCode  LEFT OUTER JOIN ufdata_002_2008..Warehouse W ON CS.cWhCode = W.cWhCode  left joinufdata_002_2008..vendor v1 on v1.cvencode = cs.cvmivencode  LEFT OUTER JOIN ufdata_002_2008..v_aa_enum E with (nolock) on E.enumcode=convert(nchar,CS.cMassUnit) and E.enumType=N'ST.MassUnit'

                               
登录/注册后可看大图
........
发表于 2011-1-27 14:30:19 | 显示全部楼层
楼主为什么要在SQL里查询呢?在用友前台不是可以查询吗?
发表于 2016-7-20 15:14:20 | 显示全部楼层
怎样可以看到呀
回复 点赞 拍砖

使用道具 举报

发表于 2018-12-7 14:37:29 | 显示全部楼层
我是来混积分的。。。。。
回复 点赞 拍砖

使用道具 举报

发表于 2018-12-13 10:43:57 | 显示全部楼层
进来学习下
回复 点赞 拍砖

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-25 23:47 , Processed in 0.050972 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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