I want to generate a unique random integer (from 10000 to 99999) identity just by clean mySQL; any ideas?
I don\'t want to generate this number in php by cycling (ge
I struggled with the solution here for a while and then realised it fails if the column has NULL entries. I reworked this with the following code;
SELECT FLOOR(10000 + RAND() * 89999) AS my_tracker FROM Table1 WHERE "tracker" NOT IN (SELECT tracker FROM Table1 WHERE tracker IS NOT NULL) LIMIT 1
Fiddle here; http://sqlfiddle.com/#!2/620de1/1
Hope its helpful :)