SQL 错误“1 接近 'inner',语法错误”W3C 示例数据库

SQL ERROR "1 near 'inner', Syntax Error" W3C sample database

select OD.orderID, C.CustomerName, O.OrderDate,          
    round(sum(P.Price*OD.Quantity)) as TotalPrice 
inner join OrderDetails as OD on OD.OrderID=O.OrderID 
inner join Products as P on OD.ProductID=P.ProductID 
inner join Customers as C on O.CustomerID=C.CustomerID 
group by OD.OrderID 
Order by TotalPrice 
limit 5

这是我的 SQL 声明。它给我 'inner' 语法错误... 请问有什么问题吗?

您的 SQL 语句缺少 FROM 子句:

select OD.orderID, C.CustomerName, O.OrderDate,          
  round(sum(P.Price*OD.Quantity)) as TotalPrice 
FROM <your driving table here>
inner ...

据推测,您想 select 来自 Orders:

select OD.orderID, C.CustomerName, O.OrderDate,          
  round(sum(P.Price*OD.Quantity)) as TotalPrice 
FROM Orders as O
inner ...