导出订单SQL语句【8】

select 'country_id' AS customers_country,
'delivery_name' AS delivery_name,
'delivery_street_address' AS delivery_street_address,
'delivery_city' AS delivery_city,
'delivery_postcode' AS delivery_postcode,
'delivery_phone' AS delivery_phone,
'delivery_state' AS delivery_state ,
'delivery_country' AS delivery_country,
'payment_method' AS payment_method,
'date_purchased' AS date_purchased,
'orders_status_name' AS orders_status_name,
'currency' AS currency,
'products_id' AS products_id,
'products_model' AS products_model,
'products_name' AS products_name,
'products_price' AS products_price,
'products_tax' AS products_tax,
'final_price' AS final_price,
'products_quantity' AS products_quantity,
'order_subtotal' AS order_subtotal,
'coupon_code' AS coupon_code,
'discount_coupon' AS discount_coupon,
'group_discount' AS group_discount,
'gift_certificates' AS gift_certificates,
'shipping_method' AS shipping_method,
'shipping' AS shipping,
'tax' AS tax,
'grand_total' AS grand_total
union all
SELECT DISTINCT
country_id AS customers_country,
CONCAT(customer_firstname,customer_lastname) AS delivery_name,
street AS delivery_street_address,
city AS delivery_city,
postcode AS delivery_postcode,
telephone AS delivery_phone,
state AS delivery_state ,
country_id AS delivery_country,
'' AS payment_method,
'' AS date_purchased,
STATUS AS orders_status_name,
store_currency_code AS currency,
product_id AS products_id,
sku AS products_model,
NAME AS products_name,
price AS products_price,
'' AS products_tax,
row_total AS final_price,
'1' AS products_quantity,
row_total AS order_subtotal,
coupon_code AS coupon_code,
'' AS discount_coupon,
'' AS group_discount,
'' AS gift_certificates,
shipping_method AS shipping_method,
shipping_invoiced AS shipping,
price_incl_tax AS tax,
row_total AS grand_total
FROM  
sales_flat_order AS o INNER JOIN sales_flat_order_address AS a INNER JOIN sales_flat_order_item AS i 
WHERE o.entity_id=i.order_id AND o.entity_id=a.parent_id AND address_type='billing'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值