Elinimar Data of Several SQL Tables

0

I'm trying to delete the records of my DB but only the first 2 tables are deleted, nothing happens in the third one.

DELETE
  cliente,
  historia,
  descripcion
FROM
  cliente
INNER JOIN
  historia ON historia.idCliente = cliente.idCliente
INNER JOIN
  descripcion ON historia.idDescripcion = descripcion.idDescripcion
WHERE
  cliente.idCliente = 6

Only the table cliente e historia is deleted in the table descripcion nothing happens

The DB physical is related as well;

Cliente <----------(1,n) Historia (1,1)-----------> Descripcion
    
asked by user75463 17.08.2018 в 19:52
source

1 answer

0

Instead of inner, use left and relate the tables taking as reference the first table:

DELETE
  cliente,
  historia,
  descripcion
FROM
  cliente
LEFT JOIN
  historia ON cliente.idCliente=historia.idCliente
LEFT JOIN
  descripcion ON descripcion.idDescripcion =historia.idDescripcion
WHERE
  cliente.idCliente = 6
    
answered by 30.08.2018 в 22:12