List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 2 2001 3:50pm
Subject:Re: Counting Sequences Clarified
View as plain text  
At 9:04 PM +1000 10/2/01, Bruce Collins wrote:
>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.

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 PRIMARY KEY (name, seqnum)

name should have been declared NOT NULL as well.

Paul DuBois, paul@stripped
Counting Sequences ClarifiedBruce Collins2 Oct
  • Re: Counting Sequences ClarifiedPaul DuBois2 Oct
RE: Counting Sequences ClarifiedTom Haapanen2 Oct