#我这里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,t3.type_id
FROM sales_flat_order_item AS t1
LEFT JOIN catalog_product_entity_int AS t2 ON t2.entity_id=t1.product_id
left join catalog_product_entity as t3 on t3.entity_id=t1.product_id
WHERE t1.created_at >= DATE_ADD(NOW(), INTERVAL -1 MONTH) AND t2.attribute_id=96 AND t2.value=1
and t3.type_id='simple'
GROUP BY t1.sku
ORDER BY total_ordered DESC