On Wed 2003-03-12 at 11:16:09 -0600, [EMAIL PROTECTED] wrote:
> At 11:41 -0500 3/12/03, Douglas B. Jones wrote:
> >Hi,
> >
> >I understood replace to only increment n when it matches the
> >name value.
In that case, you want a primary key on (name,n) with n being
auto_increment.
> There are 122,111 statements, but when you add
> >up the numbers in the n column, they exceed 122,111. They should
>
> I don't know what you're trying to say here. If you *add up* the
> numbers in the column, of course they will exceed the number of records.
I think he expects one row for each name, with the n being the
(original) number of rows which had that name.
If I am correct, another way to reach the same goal is to simply
insert all rows as (without unique key on name, only a normal key) and
then do a
SELECT name, COUNT(*) FROM virus GROUP BY name;
This has the advantage that you, Douglas, can keep timestamps and so
on which enables better analysis afterwards. If you are not interested
in other data, but only the one-time analysis you presented, why
(mis-)use a database at all? Simple do something like
$ sort < file_with_names | uniq -c
in the shell (I presume you have shell access because you used grep
before).
HTH,
Benjamin.
--
[EMAIL PROTECTED]
---------------------------------------------------------------------
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