/*根据SKU,查询订单信息*/
SELECT
order_table.increment_id,
item_table.created_at,item_table.sku,
order_table.customer_email, CONCAT_WS('',order_table.customer_firstname,order_table.customer_middlename,order_table.customer_lastname) AS `BilltoName`, CONCAT_WS('',address_table.firstname,address_table.middlename,address_table.lastname) AS `ShiptoName`, CONCAT_WS(', ',address_table.street,address_table.city,address_table.region) AS `ShippingAddress`,
address_table.city,region_table.code,address_table.postcode,
address_table.telephone
FROM sales_flat_order_item AS item_table
LEFT JOIN sales_flat_order AS order_table ON order_table.entity_id=item_table.order_id
LEFT JOIN sales_flat_order_address AS address_table ON address_table.parent_id=order_table.entity_id
LEFT JOIN directory_country_region AS region_table ON region_table.default_name=`address_table`.region
WHERE item_table.created_at >= '2015-06-01' AND address_table.address_type='shipping' and item_table.sku='SP30191BK'
Magento 根据SKU查询订单信息的SQL语句
最新推荐文章于 2020-07-03 11:10:09 发布