Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select count(*) from contacts
- join accounts_contacts on contacts.id = accounts_contacts.contact_id
- join accounts on accounts.id = accounts_contacts.account_id
- where contacts.deleted = 0 and accounts.deleted = 0 and accounts_contacts.deleted = 0
- and (contacts.assigned_user_id <> accounts.assigned_user_id OR
- contacts.team_id <> accounts.team_id OR
- contacts.team_set_id <> accounts.team_set_id);
- update contacts
- join accounts_contacts on contacts.id = accounts_contacts.contact_id
- join accounts on accounts.id = accounts_contacts.account_id
- set contacts.assigned_user_id = accounts.assigned_user_id,
- contacts.team_id = accounts.team_id,
- contacts.team_set_id = accounts.team_set_id,
- contacts.date_modified = NOW()
- where contacts.deleted = 0 and accounts.deleted = 0 and accounts_contacts.deleted = 0
- and (contacts.assigned_user_id <> accounts.assigned_user_id OR
- contacts.team_id <> accounts.team_id OR
- contacts.team_set_id <> accounts.team_set_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement