Skip to Content
0
Jun 17, 2020 at 03:00 PM

Query Pull from only 2 warehouses.

36 Views Last edit Jun 18, 2020 at 03:33 PM 2 rev

I have this query , and we are trying to show only 2 warehouses but it continues to pull all

SELECT Distinct T2.ItemCode, T3.ItmsGrpNam,T2.ItemName ,T2.OnHand , T4.WhsCode , sum(case when T0.[Status] ='R' then (isnull(T1.PlannedQty,0)) else 0 End) as 'Released' , sum(case when T0.[Status] ='P' then (isnull(T1.PlannedQty,0)) else 0 End) as 'Planned' , T2.IsCommited as 'Commited' , (T2.OnHand-sum(case when T0.[Status] ='R' then (isnull(T1.PlannedQty,0)) else 0 End)) as 'R-Status Qty' FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry] LEFT OUTER JOIN OITM T2 ON T1.ItemCode=T2.ItemCode LEFT OUTER JOIN OITB T3 ON T2.ItmsGrpCod=T3.ItmsGrpCod LEFT OUTER JOIN OITW T4 ON T4.[ItemCode] = T1.[ItemCode] WHERE T0.[Status] <>'L' and T0.[Status]<>'C' and T1.ItemCode Like '2%' or T1.ItemCode Like '1%' and T4.WhsCode = '02' or T4.WhsCode = '03' Group by T2.ItemCode, T3.ItmsGrpNam,T2.ItemName,T1.PlannedQty, T2.OnHand,T2.IsCommited,T4.WhsCode