[Magento SQL] 获取产品近期销售、产品类型、产品状态

来源:互联网 发布:应用层网络协议有哪些 编辑:程序博客网 时间:2024/04/28 12:46
#我这里catalog_product_entity_int表attribute_id字段的值为96 表示产品的status状态#enabled = 1,disabled = 2SELECT t1.sku,name, SUM(t1.qty_ordered) AS total_ordered, t2.value AS STATUS,t3.type_idFROM sales_flat_order_item AS t1LEFT JOIN catalog_product_entity_int AS t2 ON t2.entity_id=t1.product_idleft join catalog_product_entity as t3 on t3.entity_id=t1.product_idWHERE t1.created_at >= DATE_ADD(NOW(), INTERVAL -1 MONTH) AND t2.attribute_id=96 AND t2.value=1and t3.type_id='simple'GROUP BY t1.skuORDER BY total_ordered DESC

0 0
原创粉丝点击