-2
如何將以下SQL轉換爲Linq?如何將這個SQL轉換爲LINQ?
select ReqUserID, count(DepartmentID)
from [ReqUsersDeptMat]
where DepartmentID IN (93060,2175)
group by ReqUserID
having count(*) = 2
如何將以下SQL轉換爲Linq?如何將這個SQL轉換爲LINQ?
select ReqUserID, count(DepartmentID)
from [ReqUsersDeptMat]
where DepartmentID IN (93060,2175)
group by ReqUserID
having count(*) = 2
嘗試這種方式
from item in ReqUsersDeptMat
group item by item.ReqUserID into groupedItems
let count = groupedItems.Count()
where count =2
select new { ReqUserID= groupedItems.Key, Num_Of_Departmentid = count };
你嘗試過什麼哪裏出了問題,你有一些代碼,你可以告訴我們?這個班怎麼樣? –