我在使用 MySQL 查询时遇到以下错误。
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='RNAYAK2009@GMAIL.COM' 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='RNAYAK2009@GMAIL.COM'
and (o.status='Successful' or o.status='Pending')
请帮我解决这个错误。
最佳答案
您可能需要重新粘贴它,但看起来您粘贴的内容有两个错误:
pi. Product_name
和
pi.pro_IdWHERE
关于php - 使用 PHP 和 MySQL 在 sql 查询中获取语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35717096/