Q:

Can MYSQL keep track of multiple Auto Increments based on a column input value?

I have a table that has the base Auto Increment called post_id.  I have other columns as well, tag_id, and tag_name.
Currently, whenever I insert into this table, post_id will get auto incremented.  But what I also want to do is also auto increment tag_id depending on what tag_name is.  If tag_name is, for example, "A", then tag_id should be 1.  Next insert, tag_name is "A" tag_id is 2.  However, next insert, tag_name is "B", tag_id is now 1.  etc, etc.

A:

Both MyISAM and InnoDB support only one auto-increment per table.
Managing any autoincrement-per-group feature cannot work in a storage engine that supports concurrent updates, because of race conditions.
MyISAM supports auto-increment as a secondary column of a key, so it numbers independently for each value in the first column of the same key. But this still won't work for you because MyISAM doesn't support two auto columns per table.
mysql> create table MyTable (
    -> post_id int auto_increment primary key,
    -> tag_name varchar(10),
    -> tag_id int auto_increment,
    -> unique key (tag_name, tag_id)
    -> ) engine=myisam;
ERROR 1075 (42000): Incorrect table definition; there can be only one
auto column and it must be defined as a key

You'll have to number your tag_id manually. And that means you can't support concurrent updates to this table.
IMO, you should re-think what you're trying to do.

