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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.