Ejemplo eliminando registros buscando coincidencias de los Registros en otras tablas
En este ejemplo eliminaremos los registros buscando coincidencias de otras tablas.
aqui el codigo:
aqui el codigo:
#eliminando registros buscando coincidencias de otras tablas
delete orders
from orders
left join users as u
on u.id_user = orders.id_user
where u.id_user is null;
#eliminando registros consultando otras tablas
delete orders
from orders
inner join users as u
on u.id_user = orders.id_user
where u.id_user = "usuario2";
delete orders
from orders
left join users as u
on u.id_user = orders.id_user
where u.id_user is null;
#eliminando registros consultando otras tablas
delete orders
from orders
inner join users as u
on u.id_user = orders.id_user
where u.id_user = "usuario2";
Comentarios
Publicar un comentario