title: Storing query Results into a Variable to use later
body: <p>Like the title says, i am trying to store the results of a query in a variable so that i can use it in another query that would join them. I have been trying to do this using the <code>INTO</code> santex as it describes it on google. This is what i am entering:</p>
  
  <pre><code>mysql&gt; select Name, Type, Region from table1 union select Name, Type, Region from Table2 into @temp1;
  </code></pre>
  
  <p>However, with this, i am getting this error:</p>
  
  <pre><code>ERROR 1222 (21000): The used SELECT statements have a different number of columns
  </code></pre>
  
  <p>Which does not make sense as the <code>Select</code> statement has the same number of columns. So i figure maybe its my variable, so i remove the <code>@</code> and tried it again, but i got this error:</p>
  
  <pre><code>ERROR 1327 (42000): Undeclared variable: temp
  </code></pre>
  
  <p>So now im at a lost, what am i doing wrong? I am following the syntax that is describe on several wikis on google but with no luck.</p>