Union numbers
mysql> mysql> SELECT ROUND(RAND() * 1000) -> FROM (SELECT 0 AS NUMBER UNION SELECT 1 UNION SELECT 2 -> UNION -> SELECT 3 UNION SELECT 4 UNION SELECT 5 -> UNION -> SELECT 6 UNION SELECT 7 UNION SELECT 8 -> UNION -> SELECT 9) AS NUMBERS; +----------------------+ | ROUND(RAND() * 1000) | +----------------------+ | 877 | | 532 | | 27 | | 542 | | 628 | | 514 | | 684 | | 880 | | 345 | | 89 | +----------------------+ 10 rows in set (0.00 sec) mysql> mysql> mysql>