具有“创建”视图的多个内部联接

时间:2014-04-23 14:56:11

标签: sql join view

在SQl server 2012中创建视图表有任何错误请更正

create view Invoice as 
Select CustomerInfo.C_Name,CustomerInfo.C_ID,OrderDetails.O_ID,OrderDetails.O_name,ProductDetails.Price
from OrderDetails
inner join ProductDetails 
on OrderDetails.P_Model=ProductDetails.P_Model
inner join CustomerProduct
on OrderDetails.O_Id=CustomerProduct.O_Id
inner join CustomerInfo`on CustomerProduct.C_Id=CustomerInfo.C_Id



enter code here`

CustomerInfo =C_id primary  key
OrderDetails=O_id primary key ,P_model foreign key
ProductDetails=P_model  primary key 
CustomerProduct= C_id,O_id foreign key 

1 个答案:

答案 0 :(得分:0)

似乎你忽略了一个单引号:

CustomerInfo`on