FYI, my queries to delete customers with zero lifetime orders and with no activity for 6 months:
Code:
DELETE from zen_customers
WHERE customers_id IN
(SELECT customers_info_id from zen_customers_info where TIMESTAMPDIFF(MONTH,customers_info_date_account_created, NOW()) > 6
AND TIMESTAMPDIFF(MONTH,customers_info_date_of_last_logon, NOW()) > 6)
AND customers_id NOT IN
(SELECT customers_id FROM zen_orders);
update zen_reviews set customers_id = null where customers_id not in (select customers_id from zen_customers);
delete from zen_address_book where customers_id not in (select customers_id from zen_customers);
delete from zen_customers_info where customers_info_id not in (select customers_id from zen_customers);
delete from zen_customers_basket where customers_id not in (select customers_id from zen_customers);
delete from zen_customers_basket_attributes where customers_id not in (select customers_id from zen_customers);
delete from zen_whos_online where customer_id not in (select customers_id from zen_customers);
delete from zen_products_notifications where customers_id not in (select customers_id from zen_customers);
Bookmarks