SELECT
ps_customer.id_customer
CONCAT(ps_customer.firstname," ",ps_customer.lastname) AS "Fullname"
ps_customer.email
ps_customer.date_add
ps_orders.id_order
ps_orders.id_address_delivery
ps_orders.payment
ps_stripepro_transaction.status
ps_order_detail.id_shop
ps_order_detail.product_name
ps_address.address1
ps_address.address2
ps_address.postcode
ps_address.city
ps_address.phone
ps_address.phone_mobile
ps_vd_customer_dogs.name
ps_vd_customer_dogs.size
ps_vd_customer_dogs.breed
ps_vd_customer_dogs.toy_destroyer
ps_order_cart_rule.name
ps_order_cart_rule.value
ps_order_detail.product_quantity
ps_message.message
FROM ps_orders
LEFT JOIN ps_customer
ON ps_orders.id_customer = ps_customer.id_customer
LEFT JOIN ps_stripepro_transaction
ON ps_orders.id_order = ps_stripepro_transaction.id_order
LEFT JOIN ps_order_detail
ON ps_orders.id_order = ps_order_detail.id_order
LEFT JOIN ps_address
ON ps_orders.id_customer = ps_address.id_customer
LEFT JOIN ps_vd_customer_dogs
ON ps_orders.id_customer = ps_vd_customer_dogs.id_customer
LEFT JOIN ps_order_cart_rule
ON ps_orders.id_order = ps_order_cart_rule.id_order
LEFT JOIN ps_message
ON ps_orders.id_customer = ps_message.id_customer
ORDER BY ps_orders.id_order DESC
这是我的查询。如果我将它缩短并减少到前4个左连接,我会在10分钟内得到结果,但是当我添加其他连接时,我必须等待3个多小时。
我该如何改进?我的目标是创建一个包含我正在选择的所有数据的CSV,以便我们可以改善我办公室中许多人的工作,他们必须在PrestaShop后台检查每个客户的许多参数。