Tuesday, January 19, 2010

Cross Table Delete

Delete all accounts with their statuses are inactive and delete related contacts belong to deleted accounts.
Be careful when executing this script on your database.

DELETE account.*, contact.*
FROM account a
INNER JOIN contact c
ON a.account_id = c.account_id
WHERE a.is_active = 0

No comments:

Post a Comment