title: Inserting random numbers into a table in MYSQL
body: <p>Im trying to count the number of rows in the table and generate random numbers for the field 'random'
  Now this works:</p>
  
  <pre><code>SELECT COUNT(*) FROM my_table; 
  </code></pre>
  
  <p>and this works:</p>
  
  <pre><code>   UPDATE my_table SET random = FLOOR(6500 * RAND()) + 1;
  </code></pre>
  
  <p>But this doesn't work:</p>
  
  <pre><code>UPDATE my_table SET random = FLOOR((SELECT COUNT(*) ) * RAND()) + 1;
  </code></pre>
  
  <p>But this counts the rows as 0 and adds one so all fields have the number one instead of a unique random number.</p>
  
  <p>Any ideas what I'm doing wrong would be most helpful.</p>