I would like to add a random value to a table. While I know how to add random integers within a range, I am currently stumped on how to add a randomly selected item from a l
INSERT INTO `im`
(`im`, `service`)
SELECT LOWER(`last`),
ELT(0.5 + RAND() * 6, 'AIM', 'ICQ', 'MSN', 'Yahoo', 'GTalk', 'Other')
FROM `contact`
If you're willing to add the services to another table...
INSERT INTO `im` ( `im` , `service` )
SELECT LOWER( `last` ) , (
SELECT `service`
FROM `service`
ORDER BY RAND( )
LIMIT 1
)
FROM `contact`