-1

我收到这个特定语句的语法错误,我已经验证了该语句并检查了错误,似乎找不到任何错误,也许一双新的眼睛可能会看到一些东西。

SELECT Purchase_Order.Airline_Carrier_Code, 
       Aircraft_Purchased.*, 
       Aircraft.Unit_Price * Aircraft_Purchased.Quantity as Total_Cost 
  FROM Aircraft_Purchased 
 INNER JOIN Purchase_Order ON Aircraft_Purchased.Order_Number = Purchase_Order.Order_Number 
  INNER JOIN Aircraft_Purchased.Aircraft_ID = Aircraft.Aircraft_ID 
ORDER BY (Purchase_Order.Airline_Carrier_Code), Purchase_Order.Airline_Carrier_Code;

我收到的错误代码如下

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“.Aircraft_ID ORDER BY LENGTH(Purchase_Order.Airline_Carrier_Code), Purchase_Orde”附近使用正确的语法* *

4

2 回答 2

3

您在Aircraft第二个之后缺少表参考INNER JOIN

SELECT purchase_order.airline_carrier_code, 
       aircraft_purchased.*, 
       aircraft.unit_price * aircraft_purchased.quantity AS Total_Cost 
FROM   aircraft_purchased 
       INNER JOIN purchase_order 
               ON aircraft_purchased.order_number = purchase_order.order_number 
       INNER JOIN aircraft  <--- here
               ON aircraft_purchased.aircraft_id = aircraft.aircraft_id 
ORDER  BY purchase_order.airline_carrier_code; 
于 2013-04-26T02:28:25.873 回答
2

INNER JOIN Aircraft_Purchased.Aircraft_ID=Aircraft.Aircraft_ID ORDER BY

INNER JOINtable name和 ON 部分。

于 2013-04-26T02:31:34.907 回答