At 9:04 PM +1000 10/2/01, Bruce Collins wrote:
>Hello,
>Thank's for your interest Paul. I did a poor job
>of explaining my problem. Here is another go:
>For an athlete's first entry in the database I need a column
>value of 1. The second performance entry of the same athlete
>would have a value of 2. And so on.
>I need to apply this retrospectively to ten
>years of performance records. Ongoing updates are not an
>issue at present.
>Thanks
>Bruce

If you have a column identifies each athlete, say, by name, you can
add an AUTO_INCREMENT column and create a primary key that combines
the two columns.  Then records will be auto-numbered, individually
for each athlete name.  This assumes a version of MySQL >= 3.22.25.

ALTER TABLE tbl_name
     ADD seqnum INT UNSIGNED NOT NULL AUTO_INCREMENT,
     ADD PRIMARY KEY (name, seqnum)


name should have been declared NOT NULL as well.

-- 
Paul DuBois, [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

Reply via email to