我的代码出错了,我会感激一些帮助。这只是我尝试学习的第一天,请尽量保持简单,谢谢
#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
答案 0 :(得分:3)
检查此语法
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
实施例
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
希望这有效
答案 1 :(得分:0)
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
答案 2 :(得分:0)
当您使用JOIN子句时,您应该使用ON来连接表而不是在哪里。
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 **ON** products_description specials.products_id = products_description.products_id
LEFT JOIN products
**ON** specials.products_id = products.products_id Where products.products_quantity>0