--SELECT  Products_Joined.Quickbooks_Item_AssetAccnt AS Shelf, Products_Joined.Quickbooks_Item_CogsAccnt AS Location, Products_Joined.ProductCode, Products_Joined.ProductName, Products_Joined.ProductPopularity, Products_Joined.Vendor_Price, 'Config_FullStoreURLConfig_ProductPhotosFolder/' + Products_Joined.ProductCode + '-1.jpg' AS PhotoURL, Products_Joined.Photos_Cloned_From FROM Products_Joined
--WHERE Products_Joined.StockLowQtyAlarm > 0

SELECT 
  _VPW.Location AS Shelf, 
  _VPW.MFG_SKU AS Location, 
  cm.ProductCode, 
  p.Name, 
  p.Popularity, 
  p.Cost, 
  CONCAT(
    'https://s3.us-central-1.wasabisys.com/partswarehouse/photos/', 
    cm.ProductCode, '-1.jpg'
  ) AS PhotoURL, 
  p.HasPhoto 
FROM 
  pins p 
  JOIN client_map cm ON p.PIN = cm.PIN 
  JOIN _VPW ON p.PIN = _VPW.MFG_SKU 
WHERE 
  _VPW.OH > 0 
  AND p.HasPhoto = 0 
ORDER BY 
  _VPW.Location, 
  _VPW.MFG_SKU;