Reputation: 55
i am getting an error with my code and i would appreciate some help. this is just my first day trying to learn so please keep it as simple as possible thanks
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'FROM specials LEFT JOIN products_description LEFT JOIN products
WHERE special' at line 2
SELECT specials.specials_id, specials.products_id,specials_new_products_price, products.products_image, products.products_price,products.products_image, products.products_quantity,products.products_model,products_description.products_name,products_description.products_description,
FROM specials
LEFT JOIN products_description
LEFT JOIN products
WHERE specials.products_id = products.products_id AND specials.products_id = products_description.products_id AND products.products_quantity>0
Upvotes: 0
Views: 45
Reputation: 4411
Check this syntax
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
Example
SELECT specials.specials_id, specials.products_id,specials_new_products_price, products.products_image, products.products_price,products.products_image, products.products_quantity,products.products_model,products_description.products_name,products_description.products_description
FROM specials
LEFT JOIN products on specials.products_id = products.products_id
LEFT JOIN products_description on specials.products_id = products_description.products_id
WHERE products.products_quantity>0
Hope this works
Upvotes: 3
Reputation: 133380
wrong comma before FROM
SELECT
specials.specials_id
, specials.products_id
, specials_new_products_price
, products.products_image
, products.products_price
, products.products_image
, products.products_quantity
,products.products_model
,products_description.products_name
,products_description.products_description
FROM specials
LEFT JOIN products_description on specials.products_id = products_description.products_id
LEFT JOIN products on specials.products_id = products.products_id
WHERE products.products_quantity>0
Upvotes: 0