gpt4 book ai didi

mysql - 我的 sql 第 12 行或“order ON order-user_id = user.id”附近出现错误。有什么想法吗?谢谢

转载 作者:行者123 更新时间:2023-11-29 22:48:52 24 4
gpt4 key购买 nike

SELECT order.date,
vehicle.year,
vehicle.make,
vehicle.model,
SUM(part.price * order_details.quantity) AS price,
order.paid
FROM vehicle
INNER JOIN user
ON user.id = vehicle.user_id
INNER JOIN order
ON order.user_id = user.id
INNER JOIN order_details
ON order_details.order_id = order.id
INNER JOIN part
ON part.id = order_details.part_id

最佳答案

ORDER 是大多数 SQL 实现中的保留关键字;您可能需要使用反引号来分隔表名。

SELECT `order`.date,
vehicle.year,
vehicle.make,
vehicle.model,
SUM(part.price * order_details.quantity) AS price,
`order`.paid
FROM vehicle
INNER JOIN user
ON user.id = vehicle.user_id
INNER JOIN `order`
ON `order`.user_id = user.id
INNER JOIN order_details
ON order_details.order_id = `order`.id
INNER JOIN part
ON part.id = order_details.part_id

关于mysql - 我的 sql 第 12 行或“order ON order-user_id = user.id”附近出现错误。有什么想法吗?谢谢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28978058/

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