mysql - Opencart report module Query -
i need report form i'm trying list category, customername, email, telephone etc. except category, works when click filter button. query:
select min(o.date_added) date_start, max(o.date_added) date_end, count(*) `orders`, sum((select sum(op.quantity) `oc_order_product` op left join `oc_product_to_category` pc on (op.product_id = pc.product_id) op.order_id = o.order_id group op.order_id)) products, sum((select sum(ot.value) `oc_order_total` ot ot.order_id = o.order_id , ot.code = 'tax' group ot.order_id)) tax, sum(o.total) `total` `oc_order` o o.order_status_id > '0' , date(o.date_added) >= '2015-10-01' , date(o.date_added) <= '2015-10-22' , o.shipping_postcode = '4545456' , pc.category_id = '72'
please correct query.
pc (oc_product_to_category) known in inner query. think helps:
select min(o.date_added) date_start, max(o.date_added) date_end, count(*) `orders`, sum((select sum(op.quantity) `oc_order_product` op left join `oc_product_to_category` pc on (op.product_id = pc.product_id) op.order_id = o.order_id , pc.category_id = '72' group op.order_id)) products, sum((select sum(ot.value) `oc_order_total` ot ot.order_id = o.order_id , ot.code = 'tax' group ot.order_id)) tax, sum(o.total) `total` `oc_order` o o.order_status_id > '0' , date(o.date_added) >= '2015-10-01' , date(o.date_added) <= '2015-10-22' , o.shipping_postcode = '4545456'
question you: 'opencart report module query' use?
Comments
Post a Comment