title: SQL query that considers data from other table
body: <p>I have two tables:</p>
  <p><code>employees</code>:</p>
  <p><code>id, CMS_user_id, practice_group_id, ...</code></p>
  <p>and</p>
  <p><code>users</code>:</p>
  <p><code>id, level, ...</code></p>
  <p>I want to select all employees where <code>practice_group_id</code> is 2 but only if the respective user has a <code>level</code> of 1 according to the <code>users</code> table. I researched and I have a feeling it has something to do with the <code>UNION</code> keyword eventually, but I can't quite figure it out.</p>
  <p>In &quot;human language&quot;, the query would be like this:
  &quot;select all from <code>employees</code> where <code>practice_group_id</code> is 2 and then check the <code>CMS_user_id</code> from the employee and check in the table <code>users</code> whether the respective user with the <code>id</code> that equals <code>CMS_user_id</code> has a <code>level</code> of 1&quot;</p>