错误代码:1111。组函数使用无效 (SQL)

Error Code: 1111. Invalid use of group function (SQL)

我在 MySQL 中为牙科诊所创建了这个查询

SELECT Paz.Nome, Paz.Cognome FROM Paziente AS Paz, Visita AS Vis WHERE Vis.Paziente=Paz.CF AND MAX(Vis.Parcella)=Vis.Parcella

但错误 1111 无效。请帮助我

试试这个,我在一个join中指定了第二个table,max语句需要是子查询的形式:

SELECT 
Paz.Nome, 
Paz.Cognome 
FROM Paziente AS Paz
LEFT JOIN Visita AS Vis  ON Vis.Paziente=Paz.CF
WHERE  (SELECT MAX(Parcella) FROM Visita)=Vis.Parcella;