title: MySQL SELECT, store in a variable
body: <p>For a stored procedure, I want to do a SELECT, and store a column's value into a variable.</p>
  
  <p>How do I do this?</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>    DECLARE countTemp INT;
      SET countTemp=(SELECT COUNT(Name) FROM mytable WHERE Name= var_name LIMIT 0,1);
  </code></pre>
  
  <p>OR, like this :</p>
  
  <pre><code>    DECLARE countTemp INT;
      SELECT countTemp=ColumnXYZ FROM mytable WHERE Name= var_name LIMIT 0,1;
  </code></pre>
  
  <p>But, I tried these and MySQL says my syntax is incorrect; how do I do something like this?</p>