David T. Ashley wrote:
> Hi Chris,
>
> OK, I will try that. Thanks for the help.
>
> My assumption in reading your original post was that you didn't understand
> what I wanted to do (but you did).
>
> In order for me to use the solution you have proposed, in addition to
> working, this behavior would have to be described in the MySQL manual. The
> reason is that this seems to be the kind of behavior that could change from
> version to version.
>
> <BEGIN IMPORTANT POINT>
> I don't suppose you know the section in the manual that defines the behavior
> you're describing?
> <END IMPORTANT POINT>
>
From '3.6.9. Using AUTO_INCREMENT'
"For MyISAM and BDB tables you can specify AUTO_INCREMENT on a secondary
column in a multiplecolumn
index. In this case, the generated value for the AUTO_INCREMENT column
is calculated as
MAX(auto_increment_column) + 1 WHERE prefix=given-prefix. This is useful
when
you want to put data into ordered groups."
I didn't know it only worked in MyISAM and BDB... I almost always use
MyISAM anyway. However I don't use that feature anymore due to my
change in thinking on primary keys. The only time I use a primary key
that has more than one field is if the table is a "many to many
relationship" table and in that case neither field is auto increment.
--
Chris W
KE5GIX
"Protect your digital freedom and privacy, eliminate DRM,
learn more at http://www.defectivebydesign.org/what_is_drm"
Ham Radio Repeater Database.
http://hrrdb.com