Ramco Ramco

Ramco Ramco

  • 424
  • 3.5k
  • 576.3k

Combine 2 columns and display result

Feb 11 2025 6:05 AM

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)