Reputation: 4085
I'm trying to run the following query using phpMyAdmin:
UPDATE TABLE x SET `number` = RAND();
I want to add a random value to each row but it's giving me an error.
My idea is to try to put random values between 10 and 30 in the whole thing, so I'm trying something like this as well:
UPDATE TABLE x SET `number` = 10 + (30-10)*RAND();
Sorry for the noob question! And thank you!
Upvotes: 1
Views: 355
Reputation: 11445
You don't need the TABLE keyword.
UPDATE x SET number = 10 + (30-10)*RAND();
x being the name of the table
Upvotes: 3