참고로 필자는 주변을 수색했지만 아직 해결 방법을 파악할 수 없었습니다. 나는 아직도 SQL 서버에서 기능을 배우고 있으므로 나와 함께 인내심을 가져주십시오.멀티 파트 식별자를 예외적으로 바인딩 할 수 없습니다.
나는 두 테이블에서 양의 원하는 출력을 얻을 싶어하지만 난 내 문에 하위 쿼리를 추가 시작할 때이 오류 얻을 것이다 :
The multi-part identifier "OD.Menu Name ID" could not be bound.
이것은 내가 가지고있는 문입니다.
create view SumOfIngredientsQty_V
as
Select [Item Name], Sum(Quantity) as Quantity from [Ingredients Qty_T]
join [Ingredients_T]
on [Ingredients Qty_T].[Ingredients ID] = Ingredients_T.[Ingredients ID]
group by [Item Name]
go
누군가가 내가 "바인딩 할 수 없습니다"예외가 발생하는 이유에 가르치 려 수 :
Select IT.[Item Name], SUM(OD.Quantity) * SI.Quantity as QTY from [Order Detail_T] as OD,
dbo.SumOfIngredientsQty_V as SI
join [Ingredients Qty_T]
on [Ingredients Qty_T].[Menu Name ID] = OD.[Menu Name ID]
join Ingredients_T as It
on [Ingredients Qty_T].[Ingredients ID] = IT.[Ingredients ID]
where SI.Quantity in (Select SumOfIngredientsQty_V.Quantity as SI from SumOfIngredientsQty_V)
Group by IT.[Item Name]
나는 또한 위의 진술과 상관 관계가 뷰를 만들었습니다. 또한 필요한 경우 테이블의 관계를 포함 할 수 있습니다. 여기
편집는 관계 (I 이미지를 업로드 할 수도 있지만이 할 희망)입니다
Ingredients_T : (PK) Ingredients ID, Item Name
Ingredients Qty_T : (FK) Menu Name ID, (FK) Ingredients ID, Quantity
Menu Name_T : (PK) Menu Name ID, Price, Menu Name
Order Detail_T : (PK) Order Detail ID, (FK) Order ID, (FK) Menu Name ID, Quantity
Ingredients_T > Ingredients Qty_T < Menu Name_T > Order Detail_T
(<)에 PK가 어디로 의미.
@bummi 열이없는 경우 어떻게 열을 추가할까요? – YoHanYolo