title: Using SQL temp table inside of select query
body: <p>I am trying to create a search engine that filters and preform searches by using values from two tables.</p>
  
  <p>I have managed to create a temporary table by inner joining two tables together. However I cannot figure a way to get the mysql query to search from the temp table. </p>
  
  <pre><code>$search_query = mysql_query("SELECT first_name, last_name, major, location, class_of, campus, avatar, state, country 
  
  FROM ('SELECT users.first_name, users.last_name, users.location, users.country, tags_game.name, tags_interest.name, tags_movie.name FROM users, tags_game, tags_interest, tags_movie WHERE users.id IN (tags_game.relation, tags_interest.relation, tags_movie.relation)')
                  somealias
  
  WHERE first_name LIKE '{$first_name}%' &amp;&amp; 
      location LIKE '{$location}%' &amp;&amp;     
      state LIKE '{$state}%' &amp;&amp;
      country LIKE '{$country}%' 
  </code></pre>
  
  <p>However this doesn't work. How do I use/call temp tables inside other queries?</p>