'聚合函数或GROUP BY子句'错误信息

时间:2014-04-15 14:22:34

标签: message aggregate

查询:

select 
      d.Name as DepartmentName, 
      c.FirstName + ' ' + c.LastName as Name,  
      Max(SickLeaveHours) as 'Total Sick Leave Hours'
from 
      HumanResources.Employee e, 
      Person.Contact c, 
      HumanResources.EmployeeDepartmentHistory edh, 
      HumanResources.Department d
where edh.DepartmentID=e.EmployeeID 
      and edh.EndDate is Null 
      and d.DepartmentID=edh.DepartmentID
group by d.Name
order by 'Total Sick Leave Hours' DESC

对于我的生活,我无法弄清楚如何使这项工作。如何添加名字和姓氏?

0 个答案:

没有答案