title: query user group hide search results
body: <p>Hi I am trying to change some code so that users with certain group id do not show in search results.</p>
  
  <p>at the moment the code is</p>
  
  <pre><code>$query = 'SELECT distinct b.'.$db-&gt;nameQuote('id')
          .' FROM '.$db-&gt;nameQuote('#__users').' b';
  </code></pre>
  
  <p>I am trying to add something like the following but cannot get it to work.</p>
  
  <pre><code>select * from '.$db-&gt;quoteName('#__users').' where id not in (select user_id from #__user_usergroup_map where group_id = 8)
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks.</p>