In the database I have.
Coches(matricula,año,modelo)
Es_Dueno(id_conductor,matricula)
Persona(id_conductor, nombre, direccion)
and I want to delete the model car Mazda
of the client Santos
I made the following query:
DELETE FROM coches
WHERE coches.matricula = (
SELECT coches.matricula
FROM persona as A
INNER JOIN es_dueno as B ON A.id_conductor = B.id_conductor
INNER JOIN coches ON B.matricula = coches.matricula
WHERE A.nombre ='Santos' AND coches.modelo = 'Mazda')
And I get the following error:
1093 - You can not specify target table 'Ej1_cars' for update in FROM clause