I want to simulate an auto_increment script during insertion without a field having the auto_increment property. Here is the script for the sql statement:
insert into acct set id=(select @vid:=max(id)+1); select @vid;
Basically, I want the insertion and selection to be done with the same , so I can guarantee that the vid value is unique.
source
share