polu Posted December 22, 2022 Share Posted December 22, 2022 (edited) ¡Hola! Tengo una tienda online para mayoristas con bastantes clientes, necesito saber si hay alguna forma de localizar a los clientes inactivos para eliminarlos. Salud@s Edited December 22, 2022 by polu error en texto (see edit history) Link to comment Share on other sites More sharing options...
juanrojas Posted December 22, 2022 Share Posted December 22, 2022 hola, prueba esta consulta desde la base de datos DELETE c FROM ps_customer c WHERE NOT EXISTS ( SELECT 1 FROM ps_orders o WHERE o.id_customer = c.id_customer AND o.date_add > DATE_SUB(NOW(), INTERVAL 365 DAY) ) lo que le estas diciendo aqui es, borra los clientes que han tenido una inactividad de 365 dias Asegúrate de hacer una copia de seguridad de la base de datos antes de ejecutarla Link to comment Share on other sites More sharing options...
polu Posted December 22, 2022 Author Share Posted December 22, 2022 Ok, muchas gracias juanrojas 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now