title: SQL - store a query as a local variable
body: <p>So I need to do a query based on the results of another query. <br>Is there a way for me to set the result of a query to a variable so I can use the result of that in another query?
  <br>
  Example:<br>
  {original query} ---></p>
  
  <pre><code>SELECT
  tablea.number
  
  FROM tablea
  
  INNER JOIN tableb
  
  ON tablea.name = tableb.name
  
  WHERE tableb.zip = '11111'
  </code></pre>
  
  <p>Now I want to use this result to then do another query:</p>
  
  <pre><code>SELECT *
  
  FROM tablea
  
  WHERE number = (results of last query)
  </code></pre>
  
  <p>I think theres a way to set the first query to a variable so that that way the second one can just use the result, just not sure how. Thanks.</p>