I ran into a problem where I needed to create a random number in MySQL and couldn't find a good example, well here you go:
UPDATE table
SET column = RPAD(CONCAT(7, ROUND(RAND() * 1000)), 4, 0)
This generates a number between 7,000 and 8,000 for example...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment