Created
December 22, 2016 00:57
-
-
Save trabulium/db3da9161c83d055ad26609bc4f8a3cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select sfo.customer_id, cg.customer_group_code, customer_firstname, customer_lastname, customer_email, street, city, region, postcode, country_id, sfoi.type, sfoi.sku, sfoi.name, sfoi.qty_ordered | |
FROM sales_flat_order as sfo | |
LEFT JOIN sales_flat_order_address sfoa on (sfo.entity_id = sfoa.parent_id) | |
LEFT JOIN (SELECT order_id, GROUP_CONCAT(product_type, '\n') as type, GROUP_CONCAT(sku, "\n") as sku, GROUP_CONCAT(name, "\n") as name, GROUP_CONCAT(qty_ordered, "\n") as qty_ordered from sales_flat_order_item GROUP BY order_id) as sfoi on sfo.entity_id = sfoi.order_id | |
LEFT JOIN customer_group as cg on (sfo.customer_group_id = cg.`customer_group_id`) | |
WHERE `sfoa`.`address_type` = "shipping" | |
ORDER BY customer_id ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment