title: SQL: Retrieving custom profile field, banned status and inactive status
body: <p>I'm attempting to create a PHP file that will open up my PHPBB3 database and retrieve a list of all the Minecraft usernames on the forum which will be used as a whitelist on the associated game server. The username (urbb_profile_fields_data.pf_mcusername) needs to be filtered by the following: The username is not null, is not blank, is not banned (ID does not match an ID within urbb_banlist.ban_userid) and has been activated (urbb_users.user_inactive_reason is 0).</p>
  
  <p>My knowledge of SQL is admittedly very poor, but I have got this completely working and implemented:</p>
  
  <p><code>SELECT urbb_profile_fields_data.pf_mcusername, urbb_profile_fields_data.user_id, urbb_banlist.ban_userid
  FROM urbb_profile_fields_data, urbb_banlist
  WHERE ((pf_mcusername IS NOT NULL) AND (pf_mcusername &lt;> ''))
  AND ban_userid != urbb_profile_fields_data.user_id</code></p>
  
  <p>However, when I attempt to use:
  <code>urbb_users.user_inactive_reason</code> within <code>SELECT</code>
  and <code>urbb.users</code> within <code>FROM</code>, SQL will retrieve over 7000 results that appear to loop and over. This happens as soon as I enter <code>urbb_users</code> in <code>FROM</code>.</p>
  
  <p>Undoubtedly there's something that I'm missing here because I'm not really familiar with JOIN (I've read a few tutorials on it) so I'm hoping someone can help out here!</p>
  
  <p>Thanks.</p>