On 12 Mar 2003, at 11:41, Douglas B. Jones wrote:

> INSERT INTO virus VALUES (3,'VBS/LoveLet-E');
> INSERT INTO virus VALUES (4,'VBS/LoveLet-G');
> INSERT INTO virus VALUES (5,'WM97/Myna-C');
> 
> I would have expected 3,4,5 to be 3,1,1. I was expecting it to start
> from zero each time it got a new name, it looks like it takes the last
> n value and then start from there with the new name. Does this make
> sense what I am asking?

That's not how autoincrement values work.  You've defined that column 
as a primary key for the table, so by definition each row will have a 
unique value, so you shouldn't be expecting multiple rows to have the 
value 1.

> Is there a way of doing what I want? Yes, I
> could insert and do a count, but I was looking for another way so that
> the select would not be so resource expensive.

It makes no sense that you seem to be trying to use a count as a 
primary ID, so I'm not sure what you want.  If you just want a count, 
then get rid of the primary index and autoincrement property and do 
an INSERT IGNORE for each followed by an UPDATE query to set n = n + 
1.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org
Phone 202-667-6653

---------------------------------------------------------------------
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

Reply via email to