delete_user_meta for user in spesific group

There seem to be some misunderstandings in your function about how the $wpdb stuff works.

But also, i don’t understand what exactly is in the column “client_id”. Is it the User ID from WordPress?

In any case, be aware of the following technical Errors in your function.

1: $wpdb->prefix returns the prefix that is used in any wordpress table (if not changed: “wp_”. If your table is only named “group_client_ID”, you don’t need to put $wpdb->prefix in front of that. Also, IF your table was called for example “wp_group_client_ID”, the SQL Statement would be wrong because there are Spaces between the prefix and the “rest” of the table name (“group_client_ID”)

2: You can give $wpdb->get_results a second parameter, but this parameter is for the type of result you want to get returned. You can put in “OBJECT”, which will result in you getting an object back, or you can put in “ARRAY_A”https://wordpress.stackexchange.com/”ARRAY_N” which will result in you getting an (associative/numerically indexed) Array back.
I’m not quite sure why you put the $users in there, but that is most definitely not how this is working.

3: if i understand correctly, then the column client_ID has the wordpress user ids, and if they are in row with a group_ID of 1,2,5 or 6, the meta “terms_and_conditions” of these users shall be deleted. So why the getting the users by role, and why the foreach? This doesn’t make sense to me.

4: IF my above assumption is correct, you can do this in one simple step.
CAUTION: The following code will erase the meta_key “terms_and_conditions” from the wordpress users of whom the user_ids are in the table “group_client_ID” with a group_id of 1,2,5 or 6. IF THAT IS NOT THE INTENDED RESULT, DON’T USE IT!

function say_goodby_to_the_meta(){
    global $wpdb;
    $deleted = $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key=%s AND user_id IN (SELECT client_id FROM group_client_ID WHERE group_ID IN (1,2,5,6))",'terms_and_conditions'));
    if($deleted === false){
        //There was an error in the query. Try Replacing "DELETE" with "SELECT" and checking the resulting Error in PHPMyAdmin 
    } else {
        echo 'The Terms and Conditions Meta Key was deleted for '.$deleted.' Users.';
    }
}