Subject | Auto increment |
---|---|
Author | a_broekhuis |
Post date | 2004-11-05T09:37:54Z |
Hi,
I have the following situation: I have a table which contains data
based on an auto incremented value. But instead of only 1 item for
each increment a increment can have as many items as needed. Within an
increment the first part of the key is the auto incremented number,
the second part is also a number that needs to be auto incremented
within the first key.
So a part of the table could look like this:
Part 1, Part 2
1 1
1 2
2 1
1 3
2 2
3 1
1 4
3 2
What is the best way to solve this? I think I need a generator which
gets the last number (part 2) there is for a given entry (part1) and
increment that value.
I am using firebird 1.5.1 on windows XP
Alexander
I have the following situation: I have a table which contains data
based on an auto incremented value. But instead of only 1 item for
each increment a increment can have as many items as needed. Within an
increment the first part of the key is the auto incremented number,
the second part is also a number that needs to be auto incremented
within the first key.
So a part of the table could look like this:
Part 1, Part 2
1 1
1 2
2 1
1 3
2 2
3 1
1 4
3 2
What is the best way to solve this? I think I need a generator which
gets the last number (part 2) there is for a given entry (part1) and
increment that value.
I am using firebird 1.5.1 on windows XP
Alexander