Jump to content

Edit History

Nice-side

Nice-side

Hi i would like to add phone number and brand to this sql request anyone to help me?

 

SELECT
   d.id_order,
   d.product_name,
   o.date_add,
   o.reference,
   CONCAT_WS(' ', g.firstname, g.lastname) AS customer,
   o.total_paid_tax_incl,
   os.name AS state,
   d.product_reference,
   d.product_quantity,
   d.product_price,
   o.payment,
   c.name AS carrier_name,
   CONCAT_WS(' ', a.lastname, a.firstname, a.address1, a.address2, a.postcode, a.city) AS address_delivery,
   CONCAT_WS(' ', a.lastname, a.firstname, a.address1, a.address2, a.postcode, a.city) AS address_invoice,
   REPLACE(IFNULL(GROUP_CONCAT(cd.value), ''), '"', '\'') AS customized_data 
FROM
   ps_order_detail d 
   LEFT JOIN ps_orders o ON (d.id_order = o.id_order) 
   LEFT JOIN ps_customer g ON (o.id_customer = g.id_customer) 
   LEFT JOIN ps_carrier c ON (o.id_carrier = c.id_carrier) 
   LEFT JOIN ps_order_state_lang os ON (o.current_state = os.id_order_state) 
   LEFT JOIN ps_address a ON (a.id_address = o.id_address_delivery) 
   LEFT JOIN ps_address ab ON (ab.id_address = o.id_address_invoice) 
   LEFT JOIN ps_customization cu ON (cu.id_cart = o.id_cart) 
   LEFT JOIN ps_customized_data cd ON (cd.id_customization = cu.id_customization) 
GROUP BY
   d.id_order 
ORDER BY
   d.id_order DESC

×
×
  • Create New...