Reputation: 103
So I have the code for generating the kind of passwords I want which is
SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6) AS Paswoord
How do I make this work for all the 60 rows I already have at once. I think it might be with Inner Join etc. I have tried some stuff but the all fail.
Thanks for reading.
Upvotes: 0
Views: 57
Reputation: 425198
UPDATE USER SET
PASSWORD = SUBSTRING(MD5(RAND(ID)) FROM 1 FOR 6)
WHERE PASSWORD IS NULL -- or whatever consition matches rows you want to update
Upvotes: 1
Reputation: 14361
Try this please: sorry made a typo - anyway the above two answers are there to help you :)
UPDATE maintable
SET maintable.column = (SELECT SUBSTRING(MD5(RAND()) FROM 1 FOR 6))
Upvotes: 0