var q =
from o in db.Orders
from p in db.Products
join d in db.OrderDetails
on new{ o.OrderID,p.ProductID} equals new{ d.OrderID, d.ProductID } into details
from d in details
select new { o.OrderID, p.ProductID, d.UnitPrice };
为什么要再次 from d in details ???
相当于将查询结果添加到新表里面,表名为details,所以要重新查找
你这个应该是连表查询吧
var q = from o in db.orders
from p in db.products
join d in db.details on o.orderid equals d.orderid&&p.productid equals d.productid
select new{
orderID=o.orderid,
productID=p.productID,
UnitPrice=d.unitprice
}