SKU Purchase Report by Customer

— SKU Purchase Report by Customer
— Note: this report will display the posted date of the invoice, the invoice number, item number (SKU), item description and the extended price of the item

–Variables Below …
— Replace the XXXXX in b.custnmbr with the desired customer’s account number
— Replace the XXXXX in year(b.glpostdt) with the desired reporting year
— Replace the XX in month(b.glpostdt) with the desired reporting month
— Note: you can change the month(b.glpostdt) = XX to month(b.glpostdt) IN (‘1′,’2′,’3’) to pull more than one month of purchases

select b.glpostdt, a.sopnumbe, a.itemnmbr, a.itemdesc, a.xtndprce
from sop30300 a
inner join sop30200 b on
a.sopnumbe = b.sopnumbe and a.soptype = ‘3’
where b.custnmbr = ‘XXXXX’
and year(b.glpostdt) = ‘XXXX’ and month(b.glpostdt) = ‘XX’