我有以下SQL:
SELECT
*,
(SELECT COUNT(*) FROM WebOrder_URLHistory WHERE WebOrder_URLHistory.LeadID = Leads.LeadID) AS Sales
FROM
Leads
我想把它(select count语句)放在这个LINQ语句中,这样我就可以在我的linq语句中得到销售计数:
Dim TheLeads = (From L In DB.Leads Where L.IsDeleted = False Select L).ToList()
这可以在LINQ中完成吗?
答案 0 :(得分:6)
您可以撰写Select L, L.UrlHistory.Count()