Quello che chiede lui è un po diverso.
fai cosi (ad esempio):
CREATE TABLE `tabella` (
`anno` int(4) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`anno`,`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO `tabella` (
`anno`
)
VALUES (
'2012'
);
L'id è auto increment, e quando cambi l'anno, riparte da 1

Rispondi quotando