Actually it's not a total and can't be calculated.

The idea is that as users (with individual id_client keys) add rows the id of the row 
is auto incremented for their key only.
Example:

If user A adds 3 rows:

id      id_client
---------------
1       A
2       A
3       A

and then user B adds 2 rows

id      id_client
---------------
1       A
2       A
3       A
1       B
2       B

I am not looking for a sum of each client's records... that's an easy query... I need 
the auto incremental id's for each client.

Dan T

> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] Behalf Of Harald Fuchs
> Sent: Wednesday, September 22, 2004 3:24 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Custom Auto-Increment Problem
>
>
> In article <[EMAIL PROTECTED]>,
> "Dan Tappin" <[EMAIL PROTECTED]> writes:
>
> > Hi Shawn,
> > First off thanks for the tip.  I had read that page once already but after reading 
> > twice again after your post I
> realized that the
> > answer was right there.  Wrapping that concept around my brain really hurt but I 
> > get it now.
>
> > I had this:
>
> > CREATE TABLE projects
> > (
> > id int auto_increment,
> > id_project int,
> > id _client,
> > PRIMARY KEY (id)
> > )
>
> > When I should have this:
>
> > CREATE TABLE projects
> > (
> > id int auto_increment,
> > id_client int,
> > PRIMARY KEY (id_client, id)
> > )
>
> I would not do that since it's absolutely nonstandard and works only
> with MyISAM tables.  Apparently id_clientkey is the number of records
> with the same id_client and smaller ids.  This can be easily
> calculated on the fly and thus should not be stored in the table.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to