-4
在LINQ to SQL中,這個SQL查詢的等價物是什麼?如何使用LINQ to SQL編寫此代碼?
select *
from Leads, LeadCustomAttributes LCA
where Leads.LeadID = LCA.LeadID
&& LCA.AttributeID in ('2','4','2')
在LINQ to SQL中,這個SQL查詢的等價物是什麼?如何使用LINQ to SQL編寫此代碼?
select *
from Leads, LeadCustomAttributes LCA
where Leads.LeadID = LCA.LeadID
&& LCA.AttributeID in ('2','4','2')
var query =
from lead in db.Leads
from lca in db.LeadCustomAttributes
where lead.LeadID == lca.LeadID
where new[] { "2", "4" }.Contains(lca.AttributeID)
select new { lead, lca };
int[] ids = { 2, 4, 2};
var result = from leads in context.Leads
join LCA in context.LeadCustomAttributes
ON leads.LeadID = LCA.LeadID
Where ids.Contains(ids.ContainsLeadCustomAttributes)
select leads;
感謝你們! - 欣賞它 – user1828125 2013-03-03 16:48:01