在使用MySQL查询时出现以下错误。在使用PHP和MySQL的sql查询中获取语法错误
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 'o.user_id='[email protected]' and (o.status='Successful' or o.status='Pending' at line 1
我在下面解释我的查询。
SELECT o.order_id,o.order_date,o.payment_amount,
o.status,op.pro_data_id,pd.image,pd.pro_Id,pi.Product_name
FROM db_order AS o
LEFT JOIN db_order_products AS op ON o.order_id = op.order_id
LEFT JOIN db_product_data AS pd ON op.pro_data_id=pd.pro_data_id
LEFT JOIN db_product_info AS pi ON pd.pro_Id=pi.pro_Id
WHERE o.user_id='[email protected]'
and (o.status='Successful' or o.status='Pending')
请帮我解决这个错误。
将'pi.pro_IdWHERE'改为'pi.pro_Id WHERE'和'pi。 Product_name'到'pi.Product_name' –