V175 Job Cost Lines Linked to GRN
Hi, I have an issue where a client is processing GRN's to Jobs using the SAME PartNo for multiple lines, each line being for a different Job. I am trying to get the link to work between RE_Lines and JB_CostEntryLines using the PackSlipID and InventoryID to join which works fine if different Partno's are used for each line! However in this scenario there are 9 RE Lines (same PartNo) and my query below returns 81 lines!! 9 x9.
has anyone ideas to correct this, I can't see any other distinguishing field that can ne used to qualify?
Cheers
has anyone ideas to correct this, I can't see any other distinguishing field that can ne used to qualify?
Cheers
- Code: Select all
SELECT RE_Lines.LineNumber, JB_CostEntryLines.Qty, JB_CostEntryLines.UnitCost, RE_Lines.SuppliersCost, JB_CostEntryLines.ComponentNo, JB_CostEntryLines.ComponentDesc, RE_Lines.Description, RE_Main.SlipNo,
JB_Main.JobNo
FROM RE_Main INNER JOIN
RE_Lines ON RE_Main.PackSlipID = RE_Lines.PackSlipID FULL OUTER JOIN
JB_CostEntryLines INNER JOIN
JB_Main ON JB_CostEntryLines.JobID = JB_Main.JobID ON RE_Lines.InventoryID = JB_CostEntryLines.ComponentID AND RE_Lines.PackSlipID = JB_CostEntryLines.LinkID
WHERE (RE_Main.SlipNo = '275250/INV-0772')
ORDER BY RE_Lines.LineNumber