DrByte:
I find that usually when people are asking something this specific they've already started deleting customer records from the customers table using some tool like phpMyAdmin (or even better something like Navicat or SqlYog or SequelPro). In such cases, running the following will very quickly (in a few seconds) clean up (delete) the associated records from the other related tables:```
update reviews set customers_id = null where customers_id not in (select customers_id from customers);delete from address_book where customers_id not in (select customers_id from customers);
delete from customers_info where customers_info_id not in (select customers_id from customers);
delete from customers_basket where customers_id not in (select customers_id from customers);
delete from customers_basket_attributes where customers_id not in (select customers_id from customers);
delete from whos_online where customer_id not in (select customers_id from customers);
delete from products_notifications where customers_id not in (select customers_id from customers);
i think what is missing from here is the initial delete.... if you wanted to delete all customers who have not ordered, you could use something like:
delete from customers where customers_id not in (select customers_id from orders);
and then follow with all of the remaining sql statements.
if you wanted to delete ones with the company name, it gets a little trickier as the company name is stored in the address_book table and we would have to incorporate that into the initial delete.
as with all SQL statements, i encourage you to remember an old Shakespearean saying:
"to err is human... to screw things up, you need a computer.... and to screw things up royally, you need sql...."
good luck!