title: Mysql filter subquery
body: <p>I am using Mysqli </p>
  
  <p>How can I do a single query that filters a subquery result? Is it possible? </p>
  
  <p>I need to find users from a subquery result in a particular timestamp period.</p>
  
  <p>SELECT * FROM Table WHERE (<strong>using subquery results i.e SELECT ...</strong>) BETWEEN 2017-01-08 09:00:00 AND 2017-01-08 12:00:00.</p>
  
  <p>I should get back Mr A and Mr B. </p>
  
  <p><strong>Subquery results:</strong></p>
  
  <pre><code>TimeIn                   User      TimeOut
  2017-01-06 10:00:00      Mr A      2017-01-08 11:00:00
  2017-01-07 10:00:00      Mr A      2017-01-08 12:00:00
  2017-01-08 10:00:00      Mr A      2017-01-08 13:00:00
  2017-01-08 09:00:00      Mr B      2017-01-08 11:00:00
  </code></pre>
  
  <p>Thank you for your kind help as I am quite lost on how to do this.</p>