#我这里catalog_product_entity_int表attribute_id字段的值为96 表示产品的status状态
#enabled = 1,disabled = 2
SELECT t1.sku,name, SUM(t1.qty_ordered) AS total_ordered, t2.value as status
FROM sales_flat_order_item as t1
left join catalog_product_entity_int as t2 on t2.entity_id=t1.product_id
WHERE created_at >= DATE_ADD(NOW(), INTERVAL -1 MONTH) and t2.attribute_id=96 and t2.value=1
GROUP BY sku order by total_ordered desc
[Magento SQL] 查询上架产品的近期销量统计
最新推荐文章于 2021-01-28 04:58:00 发布