SELECT 
    vm.MFG_SKU,
	COUNT(*)
FROM custopayted.orders o
JOIN custopayted.orderdetails od ON o.orderid = od.orderid
JOIN products.client_map cm ON od.productcode = cm.productcode AND cm.Client = 'Volusion'
JOIN products.pins p ON cm.PIN = p.PIN
JOIN products.vendor_map vm ON cm.PIN = vm.PIN
WHERE vm.vendorcode = 'REL'
AND NOT (
    (od.productnote NOT LIKE '% | %' AND od.productnote LIKE 'REL %')
    OR od.productnote LIKE '% | REL %'
)
AND od.productnote NOT LIKE '%STOCK%'
AND od.productnote NOT LIKE '%(C)%'
AND od.productnote NOT LIKE '%FNLA%'
AND od.productnote NOT LIKE '%LTBO%'
AND DATE(o.orderdate) BETWEEN DATE_ADD(DATE_FORMAT(NOW() ,'%Y-%m-01'), INTERVAL -1 MONTH) AND DATE_ADD(DATE_FORMAT(NOW() ,'%Y-%m-01'), INTERVAL -1 DAY)
GROUP BY vm.MFG_SKU