title: query to update record with another random record from another table?
body: <p>im having a problem with a small issue within this query</p>
  
  <pre><code>$update = mysql_query("UPDATE earnings SET userid = (SELECT ID FROM users WHERE installid is NOT NULL ORDER BY rand() LIMIT 1) WHERE userid='0'");
  </code></pre>
  
  <p>this query update the userid within the earning table when it value of '0'
  what i need to do is to update the userid where its not found within the user table
  for example
  Earnings table has 5 entries where userid=10
  the userid 10 is not found with in the users table and users table have those ids (1'2'3'4'5)
  then update this userid which have the value 10 with any of the ids found within the users table and have the installid not nulled</p>