HOW CAN I GET A SOLUTION TO AVOID DUPLICATE VALUES IN QUERY RESULT
I have one Production orderwith Qty -> 60
Two times Issued for Production
1)37.2 Qty
2)16.8 Qty
So, The Goods Issue Line Table (IGE1) Shows the issue Qty as 1st Line ->37.2 and 2nd Line ->16.8
One time Reciept from production
1) 11 Qty
So, The Goods Reciept Line (IGN1)Table Shows the issue Qty as 1st Line -> 11
Now the Actual Qty Issued For Production
=> Qty Issued for Production - Qty Reciept from production , ie,(37.2+16.8)-11 =43
So,The Production Order Line Table (WOR1) Shows the Actual Qty Issued as 9
Now I want to get the Goods issue details with Actual Qty Issued using Sql Query.
Here,
My Query with result as given below
SELECT T0.[DocNum][GOODS ISSUE NO],T2.DocNum[WORK ORDER NO], T0.[U_VenName][PARTY NAME], T1.ItemCode[ITEMCODE],
T1.[Dscription][DESCRIPTION], T1.[unitMsr][UOM], T1.Quantity[ISSUED QTY], T6.Quantity[RECIEPT QTY],T3.[IssuedQty][ACTUAL QTY ISSUED]
FROM OIGE T0
INNERJOIN IGE1 T1 ON T0.DocEntry = T1.DocEntry
INNERJOIN OWOR T2 On T1.BaseRef=T2.DocNum
INNERJOIN WOR1 T3 ON T2.DocEntry = T3.DocEntry and T1.ItemCode=T3.ItemCode
InnerJoin OITM T4 on T1. ItemCode = T4.ItemCode
innerJoin NNM1 T5 On T5.Series=T0.Series
INNERJOIN IGN1 T6 ON T6.BaseRef = T2.DocNum
where T0.U_VenName='Manjunatha Engineers Enterprises' orderby T2.docnum
GOODS ISSUE NO | WORK ORDER NO | PARTY NAME | ITEMCODE | DESCRIPTION | UOM | ISSUED QTY | RECIEPT QTY | ACTUAL QTY ISSUED |
10162 | 101328 | Manjunath Engineers Enterprises | SS316AA7 | SS 316 HEX 7 | Kgs |
| 11 | 43 |
30134 | 101328 | Manjunath Engineers Enterprises | SS316AA7 | SS 316 HEX 7 | Kgs |
| 11 | 43 |
But I want the Actual result as Like this ,
GOODS ISSUE NO | WORK ORDER NO | PARTY NAME | ITEMCODE | DESCRIPTION | UOM | ISSUED QTY | RECIEPT QTY | ACTUAL QTY ISSUED |
10162 | 101328 | Manjunath Engineers Enterprises | SS316AA7 | SS 316 HEX 7 | Kgs |
| 11 | 43 |
30134 | 101328 | Manjunath Engineers Enterprises | SS316AA7 | SS 316 HEX 7 | Kgs |
| 0 | 0 |
Actual Qty Issued and Reciept Qty values are duplicated ..it will affect the sum (Actual Qty Issued) & sum (Reciept Qty ).
if the Production order No same then the Actual Qty Issued and Reciept Qty will display one times only,others leave it as ‘0’
Please help me to giving a correct query solve these issues.....