insert into active_users (`user_id`) select users.id from users inner join twitter_identities on users.persona_id = twitter_identities.persona_id and twitter_identities.followers_count < 70000 and users.id in (select profile_collaborators.user_id from accounts join profile_collaborators join business_profiles ON accounts.id = profile_collaborators.account_id and accounts.active_business_profile_id = business_profiles.id where accounts.last_request_at > '2013-01-01 00:00:00' or business_profiles.subscription_type != 'free')
Comments