【发布时间】:2014-07-24 09:39:49
【问题描述】:
代码出错... Staff.StaffId/Name 总是被指出为错误。 想要在supervisor ID=7和'years in service'
Column 'Staff.Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select staffId,Name, DATEDIFF(year,DateJoin,GETDATE()) as 'Years in Service' from Staff
JOIN Branch ON Branch.BranchNo=Staff.BranchNo
where SupervisorID=7
having COUNT(*) <10
【问题讨论】:
标签: asp.net sql error-handling group-by