In query SELECT Articles.articleId, Products.*, Brands.name AS brandName, ProductCategories.name AS categoryName FROM (Products, Brands, ProductCategories) LEFT JOIN Articles ON Articles.productId = Products.productId WHERE Products.brandId=Brands.brandId AND Products.categoryId = ProductCategories.categoryId AND Products.productId= Error 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 '' at line 1