私はlaravelとして知られている別のPHPフレームワークで同様のレポートを作成しました。クエリーはlaravelに属しているので少し違いますが、コンセプトを得ることができます。私の要件は特別価格ではありませんでしたので、ここでは見つけられません。 Build an sql query for all enabled products in magento database
:
$result=DB::table('catalog_product_flat_1 as t1')
->join('sales_flat_order_item as t2', 't1.entity_id', '=', 't2.product_id')
->join('eav_attribute_set as t3','t1.attribute_set_id','=','t3.attribute_set_id')
->join('cataloginventory_stock_status as t4','t1.entity_id','=','t4.product_id')
->select
( 't1.entity_id','t1.sku','t1.name','t1.url_path','t1.created_at',
't1.product_type','t3.attribute_set_name','t1.price','t4.stock_status',
DB::raw('sum(t2.qty_ordered) as sum')
)
あなたはまた、私の以前の質問のいずれかを参照することができます:私は明日までに答えを編集し、あなたに適切なクエリを与えることをしようとします