Either an aggregate function or the GROUP BY clause
I used the following query:
select Patients.LastName,
   avg (PatientVisits.Pulse)as pulse,
   avg (patientvisits.depressionlevel)as depressionLevel
from Patients
left join PatientVisits
  on Patients.PatientKey=PatientVisits.PatientKey
but I get the following error:
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.
 
No comments:
Post a Comment