How to find autoincrement value of groups?


2004-05-17 04:47:42 AM
cppbuilder58
Dear All,
I need to solve an autoincrement problem in my database.I have
2 group numbers and sort numbers are attached to them.For
example :
100-1
100-2
100-3
100-4
100-5
.
.
101-1
101-2
101-3
101-4
So i need two different group but i need to assign the latest
number to new record of the group.For example when i want to
get the latest number of group 100, it should give 6.But for
101 it should give 5 (I'm mentioning about the example
above).But if i delete a record in it, it should give me the
deleted records number then latest number.For example :
100-1
100-2
100-3
100-4
100-6
100-7
100-9
When i request the latest number it should give
me ,8,10,11,12,13,14....
So how to achieve this goal? I can not find an easy way to do
this.Could you give me an example please? I'm using Zeos
6.1+BCB+MySQL 5.0
Eugene