I have a set of records (360 total) that are already assigned a relational ID to 3 other records (2 sets of 144 records, and 1 set of 72) I want to group the records in sets of 12 to assigning a _group_index and then start over again for the next relational ID.
For Example:
The first 144 records would already have the same relational ID (Let's say A). In relational set A, the first 12 records would receive a _group_index of 0, records 13-24 would receive a _group_index of 1, all the way through records 133-144 receiving a _group_index of 11. This is the end of relational set A, so relational set B would begin and contain 144 records as well. I would like the _group_index to start over and the first 12 records of relational set B (records 145-156) would receive a _group_index of 0. The number of records in each relational set is not always the same, but they are always a factor of 12. Relational set C in this example is a total of 72 records, so its first 12 records (records 289-300) would receive a _group_index of 0.