1
Answer

Combine 2 columns and display result

Ramco Ramco

Ramco Ramco

2d
88
1

Hi

  I have below query . I want to display QtyIn-Qty Out and difference should be > 0

SELECT T1."WhsCode",T1."ItemCode",T1."BatchNum",
(Select Sum("Quantity") from IBT1 where "WhsCode" = T1."WhsCode" and "ItemCode" = T1."ItemCode" and "BatchNum" = T1."BatchNum" and "Direction" = 0) As "Qty In",
(Select Sum("Quantity") from IBT1 where "WhsCode" = T1."WhsCode" and "ItemCode" = T1."ItemCode" and "BatchNum" = T1."BatchNum" and "Direction" = 1) As "Qty Out"
FROM IBT1 T1 
Left Join OITM T2 on T2."ItemCode" = T1."ItemCode"
group by T1."WhsCode",T1."ItemCode",T1."BatchNum"

 

Thanks

Answers (1)