SQL ERROR"1'附近'内部',语法错误"W3C示例数据库

Kir*_*ans 0 sql w3c inner-join

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
Run Code Online (Sandbox Code Playgroud)

这是我的SQL语句.它给了我"内在的"语法错误......我可以问一下这是什么问题吗?

Fra*_*itt 5

您的SQL语句缺少该FROM子句:

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

据推测,您想要选择Orders:

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