title: MySQL, Find all employees of a "manager"
body: <p>I have a "manager" that can be assigned to many locations and handles one department in every location. I want a query that can grab all of this:</p>
  
  <p><a href="http://sqlfiddle.com/#!2/33453c/1" rel="nofollow">http://sqlfiddle.com/#!2/33453c/1</a></p>
  
  <p>In the example above (in the link) you can see I have calculated how many employees are in each department.</p>
  
  <p><em>Managers</em> and <em>Employees</em> are in a table named <strong>staff</strong>, I do not want the query to retrieve the manager record(s). So user_role = "Employee";</p>
  
  <p>I run this as a raw query in <em>laravel</em> so I can retrieve them as objects:</p>
  
  <pre><code>$employees= DB::query('query goes in here')-&gt;get();
  </code></pre>
  
  <p>An example would be the manager with staff_id '5' get every employee that is in all of the locations and department the manager is part of if that makes sense?</p>
  
  <p>My guess would be:</p>
  
  <p>Pseudo</p>
  
  <pre><code>First Query SELECT ALL FROM staff, locations and departments where user_role = "employee"
  
  Second Query SELECT ALL FROM staff, locations and departments where manager id=5
  </code></pre>
  
  <p>Remove all results that do not satisfy the second query but join both queries together?</p>
  
  <p>Help would be greatly appreciated. </p>