Exists
1. T-SQL
select * from Orders o
where exists (select 1 from Product where ProductType = 'Memory'
              and ProductId = o.ProductID)2. Linq
using (MyDataContext dc = new MyDataContext())
{        var orders = from o in dc.Orders    where (from p in dc.Products
where p.ProductType == 'Memory'
select p.ProductID).Contains(o.ProductID)
select o;
}
No comments:
Post a Comment