This is my new delete query
Code:
DELETE *FROM ISCRITTIOCFNUOVI
WHERE IScrittiocfnuovi.id IN
(SELECT id
FROM qryOCFNuoviNPTemp
);
The base query (qryOCFNuoviNPTemp) is this one
Code:
SELECT ISCRITTIOCFNUOVI.id, ISCRITTIOCFNUOVI.Nome, ISCRITTIOCFNUOVI.Cognome, ISCRITTIOCFNUOVI.Data_nascita, ISCRITTIOCFNUOVI.Luogo_nascitaFROM ISCRITTIOCFNUOVI LEFT JOIN iscrittiocftemp ON (ISCRITTIOCFNUOVI.Nome = ISCRITTIOCFTEMP.Nome) AND (ISCRITTIOCFNUOVI.Cognome = ISCRITTIOCFTEMP.Cognome) AND (ISCRITTIOCFNUOVI.Data_nascita = ISCRITTIOCFTEMP.Data_nascita) AND (ISCRITTIOCFNUOVI.Luogo_nascita = ISCRITTIOCFTEMP.Luogo_nascita)
WHERE ISCRITTIOCFTEMP.Nome IS NULL
AND ISCRITTIOCFTEMP.cogNome IS NULL
AND ISCRITTIOCFTEMP.data_nascita IS NULL
AND ISCRITTIOCFTEMP.luogo_nascita IS NULL;
I had to make the base query separately cause if i put the sql of the base directly in the delete query sometimes i got records that should be not in, sometimes it works fine.
How is this possible?
I made new tables and copied records in them, after exported in another DB all the tables (before i exported my front end)