gpt4 book ai didi

php - 使用 MySQL 和 PHP 在查询中出错

转载 作者:行者123 更新时间:2023-11-29 04:00:04 25 4
gpt4 key购买 nike

我在使用 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 'pr.pro_Id=p.pro_Id JOIN db_supplier AS s pr.supplier_id=s.supplier_id JOIN db_or' at line 1

我在下面解释我的查询。

 SELECT
pr.pro_data_id,pr.pro_Id,pr.specification,pr.Discount,pr.Offer,pr.unit_cost_price,pr.unit_sale_price,pr.quantity
AS
total_quantity,pr.shipping_charge,pr.product_code,pr.policy,pr.supplier_id,pr.latest_sale_price,pr.pro_status,pr.sale_price,p.Product_name,s.user_name,op.order_id,op.quantity
AS
ordered_quantity,op.final_price,op.prod_tot_price,op.delstatus,op.status,o.order_date,o.shipping_id,sh.name
FROM db_product_data AS pr JOIN db_product_info AS p
pr.pro_Id=p.pro_Id JOIN db_supplier AS s pr.supplier_id=s.supplier_id
JOIN db_order_products AS op pr.pro_data_id=op.pro_data_id JOIN
db_order AS o op.order_id=o.order_id JOIN db_shipping_address AS sh
o.shipping_id=sh.shipping_id WHERE pr.pro_data_id='63' AND
pr.pro_Id='36' ORDER BY pr.pro_data_id DESC

我该如何解决这个错误?

最佳答案

您在查询中错过了很多次:-

SELECT
pr.pro_data_id,pr.pro_Id,pr.specification,pr.Discount,pr.Offer,pr.unit_cost_price,pr.unit_sale_price,pr.quantity
AS total_quantity,pr.shipping_charge,pr.product_code,pr.policy,pr.supplier_id,pr.latest_sale_price,pr.pro_status,pr.sale_price,p.Product_name,s.user_name,op.order_id,op.quantity
AS ordered_quantity,op.final_price,op.prod_tot_price,op.delstatus,op.status,o.order_date,o.shipping_id,sh.name
FROM db_product_data AS pr
JOIN db_product_info AS p ON pr.pro_Id=p.pro_Id
JOIN db_supplier AS s ON pr.supplier_id=s.supplier_id
JOIN db_order_products AS op ON pr.pro_data_id=op.pro_data_id
JOIN db_order AS o ON op.order_id=o.order_id
JOIN db_shipping_address AS sh ON o.shipping_id=sh.shipping_id
WHERE pr.pro_data_id='63' AND
pr.pro_Id='36' ORDER BY pr.pro_data_id DESC

希望对你有帮助:)

关于php - 使用 MySQL 和 PHP 在查询中出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35217504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com