mysql - Magento - Who ordered what in Magento webshop with a query on db? -


i'm trying figure out orders in our webshop our marketing intern can figure out every customer worth, etc.

i've built query, doesn't seem work correctly:

select e.*, sfoi.*, sfoa.lastname, sfoa.email, sfoa.street, sfoa.postcode, sfoa.country_id sales_flat_order e inner join sales_flat_order_item sfoi on (e.entity_id=sfoi.order_id)  inner join sales_flat_order_address sfoa on (e.customer_id=sfoa.customer_id) date_format(e.created_at, '%y') '2015'  , sfoi.parent_item_id null  , sfoi.qty_ordered > 0; 

the matching of customer_id gives wrong results , don't think understand database model found on magereverse.com thoroughly enough figure 1 out.

we working magento 1.7.0.2. appreciated.

-edit- think found solution:

select e.*, sfoi.*, sfoa.lastname, sfoa.email, sfoa.street, sfoa.postcode, sfoa.country_id sales_flat_order e inner join sales_flat_order_item sfoi on (e.entity_id=sfoi.order_id)  inner join sales_flat_order_address sfoa on (e.entity_id=sfoa.parent_id) date_format(e.created_at, '%y') '2015'  , sfoi.parent_item_id null  , sfoi.qty_ordered > 0; 

magento 1.7.0.2 provide report filters available under reports menu in admin panel. have such report tools like:

reports > sales > orders

reports > products > bestsellers

reports > products > products ordered

reports > customers > customers order totals

reports > customers > customers number of ordes

etc.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -