我正在尝试查找每种类型所有者的工作时间总和,不包括 ExperienceLevel 为“初级”的员工的服务和少于 3 名成员的任何 ExperienceLevel 类型。我一直在努力解决这个问题,但无法得到答案......
表格:
OWNER ( OwnerID, OwnerName, OwnerEmail, OwnerType )
PROPERTY ( PropertyID, PropertyName, Street, City, State, Zip, OwnerID )
EMPLOYEE ( EmployeeID, LastName, FirstName, CellPhone, ExperienceLevel )
SERVICE ( PropertyID, EmployeeID, ServiceDate, HoursWorked )
我的最新查询:
SELECT OwnerType, SUM(HoursWorked) AS SumOfHoursWorked
FROM EMPLOYEE, SERVICE, OWNER
WHERE EMPLOYEE.EmployeeID = SERVICE.EmployeeID
AND EMPLOYEE.ExperienceLevel <> 'Junior'
AND (SELECT COUNT(ExperienceLevel) > 2)