T-Sql ‘exists’ command in Linq to Sql
Filed under: T-Sql to Linq Upgrade — admin @ 4:38 pm
T-Sql exists Usage:
select *
from Customers c
where exists(select *
from Orders
where ShipCountry = ‘Germany’
and CustomerId = c.CustomerId)
Linq contains usage instead of exists:
DataClassesDataContext db = new DataClassesDataContext();
var Cust = from c in db.Customers
where (from o in db.Orders
where o.ShipCountry == “Germany”
select o.CustomerID).Contains(c.CustomerID)
select c;

Thanks for this tip! This was exactly what I was looking for
Comment by Jeroen Landheer — April 3, 2008@ 7:13 pm
< blockquote >< a href=”http://pillspot.org/”>Pillspot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. High quality pills. Buy drugs online< /a >…
Buy:Prevacid.Prednisolone.Retin-A.100% Pure Okinawan Coral Calcium.Mega Hoodia.Valtrex.Zyban.Arimidex.Human Growth Hormone.Actos.Zovirax.Nexium.Lumigan.Petcam (Metacam) Oral Suspension.Accutane.Synthroid….
Trackbackby LAWRENCE — July 1, 2010@ 4:27 pm
audio http://cmp38bkaqg.03GMCPARTS.US/tag/Cable+PC+audio/ : PC…
Cable…
Trackbackby Cable — August 30, 2010@ 5:18 am
2009 http://zgu.oll.ii99.co : 2009…
2009…
Trackbackby 2009 — September 15, 2010@ 4:43 am