Jump to content

JOIN Syntax


luminous

Recommended Posts

I'm having trouble trying to understand where to put a 'join' in this query, this returns:

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ps_orders ON O.id_order = OD.id_order AI.id_address=id_address_invoice AND' at line 34

 


SELECT  
                O.`id_order`,
        OD.id_order,
	O.`date_add`,
	O.`total_paid`,
	O.`total_shipping`,
	O.`delivery_date`,
	O.`invoice_date`,
	C.`id_gender`,
	AD.`firstname`,
	AD.`lastname`,
	AD.`company`,
	C.`email`,
	AD.`phone_mobile`,
	AD.`phone`,
                CONCATC(AD.`address1`, " ", AD.`address2`, " ", AD.`postcode`, " ", AD.`city`),
	CONCAT(AI.`address1`, " ", AI.`address2`, " ", AI.`postcode`, " ", AI.`city`),
	OD.`product_name`,
	OD.`product_quantity`,
	OD.`product_weight`,
	OD.`product_price`,
	CA.`name`,
	CL.`delay`,
	M.`name`
FROM
               ps_carrier_lang AS CL, 
               ps_carrier as CA, 
               ps_orders AS O, 
               ps_customer AS C, 
               ps_order_detail AS OD,
               ps_manufacturer AS M,
               ps_address AS AD, 
               ps_address AS AI 
LEFT OUTER JOIN ps_order_detail, ps_orders
	ON O.id_order =  OD.id_order
	AI.id_address=id_address_invoice AND 
	AD.id_address=id_address_delivery AND 
	CA.id_carrier = O.id_carrier = CL.id_carrier AND
	C.id_customer=O.id_customer AND
                O.id_order = 28

 

Can someone please help?

Link to comment
https://forums.phpfreaks.com/topic/203734-join-syntax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.