5
我用下面的查询:聚合函数或GROUP BY子句
select Patients.LastName,
avg (PatientVisits.Pulse)as pulse,
avg (patientvisits.depressionlevel)as depressionLevel
from Patients
left join PatientVisits
on Patients.PatientKey=PatientVisits.PatientKey
,但我得到了以下错误:
Msg 8120, Level 16, State 1, Line 1 Column 'Patients.LastName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
非常感谢您的工作。我不能相信我错过了那么简单的事情。 – user2726146