SELECT 
	_VPW.location AS QuickBooks_Item_AssetAccnt, 
	_VPW.MFG_SKU AS Quickbooks_Item_CogsAccnt, 
	MAX(pins.Name) AS Name, 
	MIN(_VPW.TX) AS MinQty,
	MAX(_VPW.TX) AS MaxQty
FROM
	products._VPW
JOIN products.pins on _VPW.MFG_SKU = pins.PIN
GROUP BY
	_VPW.location,
	_VPW.MFG_SKU 
HAVING 
	(MIN(_VPW.TX) != MAX(_VPW.TX))
	OR (MIN(_VPW.TX) < 0 AND MAX(_VPW.TX) < 0)
ORDER BY
	_VPW.location,
	_VPW.MFG_SKU