我正在尝试在此查询中进行转换
from lckr in BD.Inventory_Lockers join emp in BD.Employees on lckr.EmployeeID equals emp.EmployeeID
join jti in BD.JobTitles on emp.JobTitleID equals jti.JobTitleID
join dpt in BD.JobTitles on jti.DepartmentID equals dpt.DepartmentID
select new { DepartmentN = dpt.Department.DepartmentName, asignationDate= lckr.asignation_date, lockers = lckr.LockersID.Count() }
.ToList())
答案 0 :(得分:0)
我了解您想转换为T-SQL,如下所示
SELECT
dpt.DepartmentName AS DepartmentN
,lckr.asignation_date AS asignationDate
,COUNT(lckr.LockersID) AS lockers
FROM Inventory_Lockers lckr
JOIN Employees emp ON emp.EmployeeID = lckr.EmployeeID
JOIN JobTitles jti ON jti.JobTitleID = emp.JobTitleID
JOIN Department dpt ON jti.DepartmentID = dpt.DepartmentID
GROUP BY
dpt.DepartmentName
,lckr.asignation_date