goruks 0 Denunciar post Postado Abril 11, 2011 olá gostaria de saber se é possivel fazer algo similar a esta tabela utilizando engine innodb: CREATE TABLE `teste` ( `ano` int(4) unsigned NOT NULL, `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `descricao` varchar(100) DEFAULT NULL PRIMARY KEY (`ano`,`id`), ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; tentei converter de myisam para innoDB porem da erro: #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key o objetivo é quando inserir um registro no ano por exemplo 2010 o id seja 1,2,3,4 quando ano for 2011 ele começa novamente id 1,2,3,4 Compartilhar este post Link para o post Compartilhar em outros sites
Vanilson 2 Denunciar post Postado Abril 12, 2011 Tire o ultimo auto_increment e volte a testar. Compartilhar este post Link para o post Compartilhar em outros sites
goruks 0 Denunciar post Postado Abril 13, 2011 sem o auto_increment não vai funcionar como deveria: ano 2010 autoincrement 1 ano 2010 autoincrement 2 ano 2010 autoincrement 3 ano 2011 autoincrement 1 ano 2011 autoincrement 2 ano 2011 autoincrement 3 Compartilhar este post Link para o post Compartilhar em outros sites