You can create a trigger.
create trigger my_trigger before insert on mytable for each row begin DECLARE samecount INT; set samecount = ( select count(*) from mytable where packetname = new.packetname ); if samecount = 0 then set new.updated_packet = new.packetname; else set new.updated_packet = concat(new.packetname,conv(samecount+9,10,36)); end if; end;
Before inserting a new line, it counts how many lines with the same packetname exist. When there is one or more, the counter + 9 is converted to base 36 - it is almost the same as HEX, except for the entire path to Z. Thus, if the count is 1, it becomes 1+9=10=A The resulting value is combined with packetname . If the same lines exceed 37, this will not work, but will add 10 for 38 instead.
Keep in mind that this is not exactly auto increment , and this may be due to race conditions, when two users insert the same packetname exactly at the same time, the count request may return the same value for both.
EDIT: Please note that this is the solution for when you need to insert new rows into this table and want their updated_packet be populated automatically. If you want to update existing rows as well, one way is to create a new table with the same structure, create this trigger in a new table, and then do
insert into newtable(id, subid, dollar, packetname) select id, subid, dollar, packetname from oldtable
source share