im having a problem with a small issue within this query
$update = mysql_query("UPDATE earnings SET userid = (SELECT ID FROM users WHERE installid is NOT NULL ORDER BY rand() LIMIT 1) WHERE userid='0'");
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
I’d imagine a customer would want their earnings data, of all things, to be relevant, not completely random (if some if the data is random and you don’t know which, all of the data is corrupted). That said, the query gets you where you want with
What I’d do instead is put a foreign key on the ID and prevent the random data being written in in the first place. I cannot see a solution where having random IDs would be better than not having those rows at all. If the IDs are not important, why have them at all?