ALTER TABLE `rv_clients`
ADD COLUMN `default_account_id`  int(11) NULL AFTER `account_id`;

ALTER TABLE `rv_affiliates`
ADD COLUMN `default_account_id`  int(11) NULL AFTER `account_id`;

update rv_clients c,
(select c.clientid,u.default_account_id
from rv_clients c,rv_users u
where c.account_id = u.user_id) x
set c.default_account_id = x.default_account_id
where c.clientid = x.clientid;

update rv_affiliates a,
(select a.affiliateid,u.default_account_id
from rv_affiliates a,rv_users u
where a.account_id = u.user_id) x
set a.default_account_id = x.default_account_id
where a.affiliateid = x.affiliateid;