sql >> Base de Datos >  >> RDS >> Mysql

Mysql:eliminar filas en dos tablas con claves externas

Por favor, intente esto, espero que ayude.

DELETE FROM departure, departure_time
USING departure
INNER JOIN departure_time
WHERE departure_date = '2016-09-30'
      AND departure_time.id = departure.id

O

DELETE FROM departure, departure_time
USING departure
INNER JOIN departure_time
WHERE departure_date = '2016-09-30'
      AND departure_time.departure_id = departure.id

O puede usar ON DELETE CASCADE eso funcionará automáticamente para usted.