我的代码出现错误,希望能提供一些帮助。这只是我尝试学习的第一天,所以请尽可能简单,谢谢
#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
最佳答案
检查这个语法
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
希望这能行得通
关于mysql - 如何在mysql中使用LEFT JOIN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40287105/