- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2018
07:05 AM
01-11-2018
07:05 AM
mySQL Stock Vs Sold
Hi. I am trying to use SQL to get a list of all products in the catalogue and the number sold as I am interested to see products that have never sold. I have come across the below, but this will only list products that have sold, but I can see poor performing products. Ideally i want to see products that have never sold.
I can cross reference the inventory as the inventory is no managed.
SELECT sales_flat_order_item.name, sales_flat_order_item.sku, sum(sales_flat_order_item.qty_ordered) As Qty_Sold, cataloginventory_stock_item.qty AS On_Hand FROM sales_flat_order_item, catalog_product_entity_varchar, catalog_product_entity, cataloginventory_stock_item WHERE catalog_product_entity_varchar.attribute_id = 71 AND catalog_product_entity_varchar.entity_id = cataloginventory_stock_item.product_id AND catalog_product_entity_varchar.entity_id = catalog_product_entity.entity_id AND sales_flat_order_item.sku = catalog_product_entity.sku AND sales_flat_order_item.price > 0 GROUP BY sales_flat_order_item.sku ORDER BY sales_flat_order_item.sku
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2018
03:44 AM