SUM(案例T0。[Direction] when 0 then 1 else -1 end * T0。[Quantity ])[数量]来自IBT1 T0内连接OWHS T1在T0.WhsCode = T1.WhsCode
内连接(选择T0。[ItemCode],T1。[WhsName],
SUM(CASE T0。[Direction] when 0 then 1 else -1 end * T0。[Quantity])[Quantity]
从IBT1 T0内部联接OWHS T1 ON T0.WhsCode = T1.WhsCode p>
由T1。[WhsName],T0。[ItemCode]组成)V0 ON T0。[ItemCode] = V0。[ItemCode]和t1。[WhsName] = v0。[WhsName]在T0。[ItemCode] = [%0] GROUP BY T0。[BatchNum],T1。[WhsName],v0。[Quantity],T0。[ItemCode]
嗨,
尝试以下查询:
选择T0。[ItemCode],
T1。[WhsName],
v0。[Quantity] [WhsTotal],
T0。[BatchNum],
SUM(案例T0。[Direction] when 0 then 1 else -1 end * T0。[Quantity ])[数量]来自IBT1 T0内连接OWHS T1在T0.WhsCode = T1.WhsCode
内连接(选择T0。[ItemCode],T1。[WhsName],
SUM(CASE T0。[Direction] when 0 then 1 else -1 end * T0。[Quantity])[Quantity]
从IBT1 T0内部联接OWHS T1 ON T0.WhsCode = T1.WhsCode p>
由T1。[WhsName],T0。[ItemCode]组成)V0 ON T0。[ItemCode] = V0。[ItemCode]和t1。[WhsName] = v0。[WhsName]在T0。[ItemCode] = [%0] GROUP BY T0。[BatchNum],T1。[WhsName],v0。[Quantity],T0。[ItemCode]
感谢与问候,
Nagarajan
嗨,
感谢您的回复。
请通过标记正确的答案来关闭此线程。
感谢与问候,
Nagarajan
单行查询 >
选择IBT1.ItemCode,WhsCode,BatchNum,SUM(情况为0时的方向,然后1否则-1结尾* IBT1.Quantity)[Quantity]来自IBT1 GROUP BY IBT1.ItemCode,WhsCode,BatchNum
一周热门 更多>