At 19:43 -0700 6/11/03, Q Zantos wrote:
I would like to auto-increment within an auto-incremented value.
For example, if I have a rental agreement(auto-incremented) and that rental agreement becomes month-to-month.


I was thinking that I would want to track the receipts as such:

Contract # | Type | Second Auto # | Duration |payment total
1              |  1     |   1                   | 6 months|  6,000
1              |  2     |   1                   | 1 month  | 1,000
1              |  2     |   2                   | 1 month  | 1,000

As you can see, the contract stays the same (1), but the Contract Type changes to 2(month-to-month). When this happens, the first transaction is reset to auto-increment from that point forward.

The third record illustrates the second auto-incremented #, within the Type #2.

Although I have seen many auto-incremented examples, I have yet to see one that auto-increments within another auto-incremented value.

There's a reason for that. AUTO_INCREMENT doesn't work that way.


What you *can* do is declare a multiple-column index in which the
final column is an AUTO_INCREMENT column.  What happens then is that,
for each set of rows in which the leading index column or columns have
the same value, the AUTO_INCREMENT column increase sequentially.

That doesn't seem to match your scenario, however.


Any suggestions or examples would be appreciated. Thanks.


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


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



Reply via email to