1

我在 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。请帮助我

4

1 回答 1

1

试试这个,我在join中指定了第二个表,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;
于 2017-07-21T16:03:03.317 回答