I'm getting this error but I can not figure out where I can have it done.
DELETE E.*
FROM Esordio E NATURAL JOIN (
SELECT *
FROM Esordio E2
WHERE E2.Patologia = 'Otite'
AND E2.DataGuarigione IS NOT NULL
AND YEAR(E2.DataGuarigione) < YEAR(CURRENT_DATE) - 5
AND EXISTS
(
SELECT *
FROM Esordio E3
WHERE E3.Paziente = E2.Paziente
AND E3.Patologia = E2.Patologia
AND YEAR(E3.DataEsordio)>YEAR(CURRENT_DATE)-5
)
) AS Target;