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...
Monday, December 6, 2010
Subscribe to:
Posts (Atom)