You'll need to join the usergroup map table. I'm sorry, but I cannot help you write custom SQL. That's outside the scope of support and we really need to start being more strict about it. We'll be considering a new subscription level that can provide some coding assistance.
For an easier approach you should be able to replace all of that with CB Auto Actions so you don't have to code anything.
The following would be Field actions.
Code:
UPDATE `y2vfp_comprofiler` SET `cb_activemember`='1' WHERE `user_id` = [user_id];
UPDATE `y2vfp_comprofiler` SET `cb_usertype`='h' WHERE `user_id` = [user_id];
The following would be CB Paid Subscription actions.
Code:
DELETE FROM `y2vfp_cbsubs_subscriptions` WHERE `y2vfp_cbsubs_subscriptions`.`user_id` = [user_id] AND `plan_id` = '3';
DELETE FROM `y2vfp_cbsubs_subscriptions` WHERE `y2vfp_cbsubs_subscriptions`.`user_id` = [user_id] AND `plan_id` = '10';
The following would be a User Group action.
Code:
DELETE FROM `y2vfp_user_usergroup_map` WHERE `user_id` = [user_id] AND `group_id` = '13'
The following would still need to be a query via a Query action, but you won't need the group_id in the query as you can do that in the conditions of the auto action. Will review adding support to the Field action to handle the approved/confirmed/blocked columns though so that won't need to be coded either.
Code:
UPDATE `y2vfp_comprofiler` SET `approved`='0' WHERE `user_id` = [user_id] AND `group_id` = '13';