title: Can I use the result of a previous MySQL query in the From section of another MySQL query?
body: <p>I'm using a PHP webservice where I have performed a simple SELECT query, and stored it</p>
  
  <pre><code>$result = run_query($get_query);
  </code></pre>
  
  <p>I now need to perform further querying on the data based on different parameters, which I know is possible via MySQL in the form:</p>
  
  <pre><code>SELECT * 
  FROM (SELECT *
        FROM customers
        WHERE CompanyName &gt; 'g')
  WHERE ContactName &lt; 'g'
  </code></pre>
  
  <p>I do know that this performs two Select queries on the table. However, what I would like to know is if I can simply use my previously saved query in the FROM section of the second section, such as this, and if my belief that it helps performance by not querying the entire database again is true:</p>
  
  <pre><code>SELECT * 
  FROM ($result)
  WHERE ContactName &lt; 'g'
  </code></pre>