P
pat67
Hi, I am running a query based on 3 queries
q1 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC Created on Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013
44 42 0 0 1/2/2010 11,396.00
14632
q2 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC AB date Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 12 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14638
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 14 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14636
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 18 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14637
q3 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC CH Date Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 10 2 1/2/2010 11/21/2012 CH 3/9/2010 10
11,396.00 14635
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 14 0 1/2/2010 CH 3/9/2010 11,396.00
14633
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 18 0 1/2/2010 CH 3/9/2010 11,396.00
14634
then i run this query
SELECT q1.PurchDoc, q1.Item, q1.Rel, q1.Vendor, q1.[Vendor name], q1.
[PO Date], q1.Material, q1.[Short Text], q1.MRPCn, q1.[Del Date], q1.
[PO Quantity], q1.[GR Quantity], ([q1]![PO Quantity]-[q1]![GR
Quantity]) AS [Open Qty], q1.[PD release], IIf(IsNull([q1]!
[Exc]),IIf(IsNull([q2]![Exc]),IIf(IsNull([q3]![Exc]),Null,[q3]![Exc]),
[q2]![Exc]),[q1]![Exc]) AS [Exc Code], IIf(IsNull([q1]!
[Reschdate]),IIf(IsNull([q2]![Reschdate]),IIf(IsNull([q3]!
[Reschdate]),Null,[q3]![Reschdate]),[q2]![Reschdate]),[q1]!
[Reschdate]) AS [Resch Date], q2.[AB Date], q3.[CH Date], q1.[Net
Order Value], (([q1]![Net Order Value]/[q1]![PO Quantity])*[Open Qty])
AS [Open Value], Date() AS [Extraction Date]
FROM (q1 LEFT JOIN q2 ON (q1.Item=q2.Item) AND
(q1.PurchDoc=q2.PurchDoc)) LEFT JOIN q3 ON (q2.Item=q3.Item) AND
(q2.PurchDoc=q3.PurchDoc)
GROUP BY q1.PurchDoc, q1.Item, q1.Rel, q1.Vendor, q1.[Vendor name], q1.
[PO Date], q1.Material, q1.[Short Text], q1.MRPCn, q1.[Del Date], q1.
[PO Quantity], q1.[GR Quantity], q1.[PD release], q2.[AB Date], q3.[CH
Date], q1.[Net Order Value], q1.Exc, q2.Exc, q3.Exc, q1.Reschdate,
q2.Reschdate, q3.Reschdate
ORDER BY q1.Vendor;
I am getting this duplicate value
PurchDoc Item Rel Vendor Vendor name PO Date Material
Short Text MRPCn Del Date PO Quantity GR Quantity Open Qty PD
release Exc Code Resch Date AB Date CH Date Net Order Value
Open Value Extraction Date
46353228 190 F 10000019 RA LALLI 11/6/2006 109-0718-13-101
PASSACINGHIA AK7 6/13/2013 44 42 2 1/2/2010
10 11/21/2012 3/9/2010 3/9/2010 $11,396.00 $518.00
3/19/2010
46353228 190 F 10000019 RA LALLI 11/6/2006 109-0718-13-101
PASSACINGHIA AK7 6/13/2013 44 42 2 1/2/2010
10 11/21/2012 3/9/2010 3/9/2010 $11,396.00 $518.00
3/19/2010
I should only get on entry not two.
Any ideas?
q1 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC Created on Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013
44 42 0 0 1/2/2010 11,396.00
14632
q2 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC AB date Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 12 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14638
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 14 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14636
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 18 0 1/2/2010 11/21/2012 AB 3/9/2010 10
11,396.00 14637
q3 has this
PurchDoc Item Rel Vendor Vendor name Order Type PO Date
Material Short Text MRPCn Del Date Deliv Date PO Quantity GR
Quantity QtyRed RemQty PD release Reschdate CC CH Date Exc Net
Order Value ID
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 10 2 1/2/2010 11/21/2012 CH 3/9/2010 10
11,396.00 14635
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 14 0 1/2/2010 CH 3/9/2010 11,396.00
14633
46353228 190 F 10000019 RA LALLI NB 11/6/2006
109-0718-13-101 PASSACINGHIA AK7 6/13/2013 6/13/2013
44 42 18 0 1/2/2010 CH 3/9/2010 11,396.00
14634
then i run this query
SELECT q1.PurchDoc, q1.Item, q1.Rel, q1.Vendor, q1.[Vendor name], q1.
[PO Date], q1.Material, q1.[Short Text], q1.MRPCn, q1.[Del Date], q1.
[PO Quantity], q1.[GR Quantity], ([q1]![PO Quantity]-[q1]![GR
Quantity]) AS [Open Qty], q1.[PD release], IIf(IsNull([q1]!
[Exc]),IIf(IsNull([q2]![Exc]),IIf(IsNull([q3]![Exc]),Null,[q3]![Exc]),
[q2]![Exc]),[q1]![Exc]) AS [Exc Code], IIf(IsNull([q1]!
[Reschdate]),IIf(IsNull([q2]![Reschdate]),IIf(IsNull([q3]!
[Reschdate]),Null,[q3]![Reschdate]),[q2]![Reschdate]),[q1]!
[Reschdate]) AS [Resch Date], q2.[AB Date], q3.[CH Date], q1.[Net
Order Value], (([q1]![Net Order Value]/[q1]![PO Quantity])*[Open Qty])
AS [Open Value], Date() AS [Extraction Date]
FROM (q1 LEFT JOIN q2 ON (q1.Item=q2.Item) AND
(q1.PurchDoc=q2.PurchDoc)) LEFT JOIN q3 ON (q2.Item=q3.Item) AND
(q2.PurchDoc=q3.PurchDoc)
GROUP BY q1.PurchDoc, q1.Item, q1.Rel, q1.Vendor, q1.[Vendor name], q1.
[PO Date], q1.Material, q1.[Short Text], q1.MRPCn, q1.[Del Date], q1.
[PO Quantity], q1.[GR Quantity], q1.[PD release], q2.[AB Date], q3.[CH
Date], q1.[Net Order Value], q1.Exc, q2.Exc, q3.Exc, q1.Reschdate,
q2.Reschdate, q3.Reschdate
ORDER BY q1.Vendor;
I am getting this duplicate value
PurchDoc Item Rel Vendor Vendor name PO Date Material
Short Text MRPCn Del Date PO Quantity GR Quantity Open Qty PD
release Exc Code Resch Date AB Date CH Date Net Order Value
Open Value Extraction Date
46353228 190 F 10000019 RA LALLI 11/6/2006 109-0718-13-101
PASSACINGHIA AK7 6/13/2013 44 42 2 1/2/2010
10 11/21/2012 3/9/2010 3/9/2010 $11,396.00 $518.00
3/19/2010
46353228 190 F 10000019 RA LALLI 11/6/2006 109-0718-13-101
PASSACINGHIA AK7 6/13/2013 44 42 2 1/2/2010
10 11/21/2012 3/9/2010 3/9/2010 $11,396.00 $518.00
3/19/2010
I should only get on entry not two.
Any ideas?