I can't seem to get this query to work. I want to show all the Receiving line items, quantity and cost for specific GL accounts.
My results are duplicating the data in POP30390 when there is more than one line item on the Receiving transaction.
I can't find a link between the tables to do this. If I try using the dollar amount it doesn't work because if the same line item is used twice on a receiving, it could be only one line in the distributions.
I want these two lines as part of the results:
POPRCTNM ITEM UNITS EXTDCOST ACCOUNT
RCT000999 1000 20 $500 610001
RCT000999 2000 50 $800 610002
But I am getting this:
POPRCTNM ITEM UNITS EXTDCOST ACCOUNT
RCT000999 1000 20 $500 610001
RCT000999 2000 50 $800 610001
RCT000999 1000 20 $500 610002
RCT000999 2000 50 $800 610002
Aside from running two separate queries and manually matching them up I don't know how else to proceed.
thanks,
Barb
My results are duplicating the data in POP30390 when there is more than one line item on the Receiving transaction.
I can't find a link between the tables to do this. If I try using the dollar amount it doesn't work because if the same line item is used twice on a receiving, it could be only one line in the distributions.
Code:
SELECT POP30300.VENDORID, POP30390.ACTINDX, POP30310.POPRCTNM, POP30310.ITEMNMBR, POP30310.UOFM,
POP30310.EXTDCOST/POP30310.UNITCOST AS UNITS, POP30310.UNITCOST, POP30310.EXTDCOST, IV00101.ITMCLSCD,
POP30300.GLPOSTDT, GL00100.ACTNUMBR_2, GL00100.ACTNUMBR_3, GL00100.ACTNUMBR_4
FROM POP30300
JOIN POP30310 ON POP30300.POPRCTNM = POP30310.POPRCTNM
JOIN IV00101 ON POP30310.ITEMNMBR = IV00101.ITEMNMBR
JOIN POP30390 ON POP30390.CURNCYID = POP30300.CURNCYID AND
POP30390.POPRCTNM = POP30300.POPRCTNM AND
POP30390.POPRCTNM = POP30310.POPRCTNM AND
POP30390.VENDORID = POP30300.VENDORID AND
POP30390.XCHGRATE = POP30300.XCHGRATE
JOIN GL00100 ON POP30390.ACTINDX = GL00100.ACTINDX
WHERE
(POP30300.GLPOSTDT Between '5/1/6' And '5/31/6') AND
(GL00100.ACTNUMBR_2 Like '6100%') AND
(ACTNUMBR_3+ACTNUMBR_4 In ('120000','190000','220000','227000','210000'))
ORDER BY POP30310.POPRCTNM
I want these two lines as part of the results:
POPRCTNM ITEM UNITS EXTDCOST ACCOUNT
RCT000999 1000 20 $500 610001
RCT000999 2000 50 $800 610002
But I am getting this:
POPRCTNM ITEM UNITS EXTDCOST ACCOUNT
RCT000999 1000 20 $500 610001
RCT000999 2000 50 $800 610001
RCT000999 1000 20 $500 610002
RCT000999 2000 50 $800 610002
Aside from running two separate queries and manually matching them up I don't know how else to proceed.
thanks,
Barb