Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8411

Re: Query for calculating raw material requirements for the remaining quantities in sale order.

$
0
0

If you join OITW in, you will get multiple rows because onhand is for each warehouse.

 

You may try:

 

SELECT T4.[Code] as 'Raw material Name', T2.ItemName, SUM(T4.[Quantity]) as 'BOMQTY',  SUM((T1.[OpenQty]*T4.[Quantity])) as 'TOTALQTY', T2.Onhand

FROM ORDR T0

INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]

INNER JOIN OITT T3 ON T3.[ItemCode] = T1.[Code]

INNER JOIN ITT1 T4 ON T3.[Code] = T4.[Father]

INNER JOIN OITM T2 ON T2.[ItemCode] = T4.[Code]

WHERE  T1.[LineStatus] ='o'

GROUP BY T4.[Code], T2.ItemName, T2.Onhand


Viewing all articles
Browse latest Browse all 8411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>