I like to set internal AUTO_INCREMENT counter for the table, which uses MyISAM and composite primary key - but just for specific PK combination. If I use
ALTER TABLE tablename AUTO_INCREMENT = 1;
It will set internal counter for all composite PK combinations, which I don't want.
I need something like
ALTER TABLE tablename AUTO_INCREMENT = 1 WHERE prefix = 5 AND suffix = X;
It does not work this way. Is there any possibility to change only counter for specific PK combination in MyISAM table?
Table:
CREATE TABLE `ENG__faktury_counter`
(
`year` int(10) NOT NULL,
`prefix` varchar(10) NOT NULL,
`DIC` varchar(50) NOT NULL,
`id_counter` int(15) NOT NULL AUTO_INCREMENT ,
`created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`year`,`prefix`,`DIC`,`id_counter`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8