0

如何在 linq 中转换我的子查询?我的查询是:

select *
from Product 
where ID in 
(
   select distinct(sku.ProductId) 
   from SiteProducts sp
   inner join ProductSKU sku on sp.ProductId = sku.Id
   where sp.siteid = 2
)
4

1 回答 1

2
from p in db.Product
where (from sp in db.SiteProducts
       join sku in db.ProductSKU on sp.ProductId equals sku.Id
       where sp.siteid == 2
       select sku.ProductId).Distinct().Contains(p.ID)
select p
于 2013-06-13T13:05:07.790 回答