get_results( "SELECT u.ID,
( SELECT meta_value FROM " . $wpdb -> prefix . "usermeta WHERE meta_key = 'first_name' AND user_id = u.ID ) AS firstname,
( SELECT meta_value FROM " . $wpdb -> prefix . "usermeta WHERE meta_key = 'last_name' AND user_id = u.ID ) AS lastname,
( SELECT COUNT( user_id ) FROM " . $wpdb -> prefix . "usermeta WHERE meta_key = 'user_parent' AND meta_value = u.ID ) AS referral_users
FROM
" . $wpdb -> prefix . "users AS u
WHERE
( SELECT COUNT( user_id ) FROM " . $wpdb -> prefix . "usermeta WHERE meta_key = 'user_parent' AND meta_value = u.ID ) > 0
ORDER BY referral_users DESC LIMIT 10 OFFSET 0" );