Hmm, this all sounds indeed like a terrific feature .. if it would work ! So, I decided to try it and just see what'll happen. I did the following things:
* first I created a table: mysql> create table autoIncrement ( -> id int(11) NOT NULL AUTO_INCREMENT, -> thingie varchar(20) NOT NULL, -> primary key(id, thingie) -> ); Query OK, 0 rows affected (0.28 sec) * inserted some values: mysql> insert into autoIncrement (thingie) VALUES ("bla"), -> ("boe"), -> ("boer"), -> ("en"), -> ("joy"); Query OK, 5 rows affected (0.24 sec) Records: 5 Duplicates: 0 Warnings: 0 did a select: mysql> select * from autoIncrement; +----+---------+ | id | thingie | +----+---------+ | 1 | bla | | 2 | boe | | 3 | boer | | 4 | en | | 5 | joy | +----+---------+ 5 rows in set (0.04 sec) Nothing seen from a counter for each value of thingie. I decided to insert a value for thingie wich already existed, and to repeat the select: mysql> insert into autoIncrement (thingie) values ("bla"); Query OK, 1 row affected (0.00 sec) mysql> select * from autoIncrement; +----+---------+ | id | thingie | +----+---------+ | 1 | bla | | 2 | boe | | 3 | boer | | 4 | en | | 5 | joy | | 6 | bla | +----+---------+ 6 rows in set (0.00 sec) Again, no incrementing per value for the second element of the primary key. Can you please tell me, Matthew, how did you do it? It sounds too good to be true and so it seems to be, or isn't it? Greetz, Wouter ---------- Alle door mij verzonden email is careware. Dit houdt in dat het alleen herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid. All email sent by me is careware. This means that it can only be reread and kept if you are good for all the life here on earth and beyond. If you don't agree to these terms, you should return this email in no more than 24 hours stating the reason of disagreement. -----Oorspronkelijk bericht----- Van: Matthew Walker [mailto:[EMAIL PROTECTED]] Verzonden: vrijdag 12 juli 2002 23:30 Aan: [EMAIL PROTECTED] Onderwerp: Autoincrement in MultiColumn primary key? filter: sql,query I did some tests recently on a two column primary key, one of which was an autoincrement column. It worked nicely, maintaining a separate increment for every unique value in the second column. I was ecstatic, as this was exactly what I need for some tables I'm designing. However, today I tried to use the same idea in a three column primary key, and it seems to be acting like a lone autoincrement column, instead of how it acted with two columns. What I want to know, is this: Is the two-column behavior an official feature, or is it an unintended effect? I personally /love/ that behavior, and think it should be a feature, but before I go further, I need to know if I can count on it to hang around. And if it is a feature, why it doesn't work in three column indexes. Please CC the reply-to address in your responses. Thanks for your time, Matthew Walker --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php