我有这个存储过程
Create Proc Get_Order_Production
AS
SELECT i.Name_Item
,[ID_Order]
,[Project]
,[Length]
,[Width]
,[Quantity]
,[Weight]
,[Supplier]
,[GDS_Name]
,[GDS_Date]
,[WorkshopName]
,[WorkshopDate]
,[ReservedQty]
FROM OdredDetails od
INNER JOIN ItemQuantity iq
ON iq.ID_ItemQte = od.ID_ItemQte
INNER JOIN item i
ON i.ID_Item = iq.ID_Item
where [Order].Number_Order=od.ID_Order and [Order].[Location]='PRODUCTION'
当我执行时,我收到此错误
Msg 4104, Level 16, State 1, Procedure Get_Order_Production, Line 23 [Batch Start Line 2]
The multi-part identifier "Order.Number_Order" could not be bound.
Msg 4104, Level 16, State 1, Procedure Get_Order_Production, Line 23 [Batch Start Line 2]
The multi-part identifier "Order.Location" could not be bound.
我尝试使用原始表名并使用括号但是我失败了
答案 0 :(得分:3)
USE Join
语法,从where子句
SELECT
--column names
FROM order Inner join
OdredDetails od on [Order].Number_Order=od.ID_Order
--(it is orderdetails I guess)
INNER JOIN ItemQuantity iq
ON iq.ID_ItemQte = od.ID_ItemQte
INNER JOIN item i
ON i.ID_Item = iq.ID_Item
WHERE [Order].[Location]='PRODUCTION'