
-- Bug 8213 Comment : Set Module Record Team and Team Set ID to 1 for those that point to a team that doesnt exist

UPDATE accounts 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE accounts 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE opportunities 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE opportunities 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE saved_reports 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE saved_reports		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE se_advice 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE se_advice 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE se_investments 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE se_investments 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE se_transactions 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE se_transactions 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE tasks 			SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE tasks 			SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE se_investmentoptions 	SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE se_investmentoptions 	SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE notes 			SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE notes 			SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE meetings 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE meetings 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE project	 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE project	 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);

UPDATE documents 		SET team_id='1' WHERE team_id NOT IN (SELECT id from teams);
UPDATE documents 		SET team_set_id='1' WHERE team_set_id NOT IN (SELECT id from teams);
