I have this table:
-id : primary key
-code : CHAR(8) unique
Is there a way in ANSI SQL (or MySQL) of generating a unique numeric code ( can be based on the autonumeric id ) in a single SQL statement for any number of rows? (let’s say 100)
I’m already doing this in a loop in PHP but wonder if it can be done in pure SQL.
To match the current requirements:
Alternatively based on the auto-increment:
Or to update it: