How can I make a view showing all users who have not created any nodes or made comments? I am trying to fix a site that has had more than 10,000 spam user registrations.  However, some legitimate user registrations have also been made, so I cannot simply delete all the accounts.

Manually sorting through all of this would take a very long time.  However, it appears to be the case that no spam users made any comments or created any nodes.  So, I thought I might be able to create a view that shows all the users that have not created content or made any comments, and then use VBO to delete all such users.

But, although I can make a view that shows users who have created content, I haven't been able to figure out a way that shows users who have not created any content/comments.  How might I go about this?
Before some days I was also work on some thing like this. In my registration page there is a field named looking-for. I was created a view to show all the members as per there looking-for field. It mean that if user selected male in looking for then only male is shown. I have added below code in the view. You can change condition as per your condition &amp; add relationship &amp; filter criteria.

global $user;
  $profiles = profile2_load_by_user($user);
    foreach ($profiles as $profile) {
        if ($items = field_get_items('profile2', $profile, 'field_sex')) {
        break;
      }
    }
    $i_am=$items[0]['value'];
 if($i_am=='sdmale' || $i_am=='sbmale'){

  $looking='smfemale+sbfemale';

}

if($i_am=='smfemale' || $i_am=='sbfemale'){

  $looking='sdmale+sbmale';

}

   return $looking;