Create user query function for joining meta and make it part of a WP library.
$users = $wpdb->get_results(
"SELECT {$wpdb->users}.*, {$wpdb->usermeta}.meta_value as subplan FROM {$wpdb->users}
LEFT JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id
WHERE {$wpdb->usermeta}.meta_key = '{$meta_key}'
ORDER BY {$wpdb->users}.display_name"
);
Create user query function for joining meta and make it part of a WP library.