Hi can anyone help me on how I can group data by defining programatically a group number for a defined group of data using its parent_id. Here's how the data looks:
| PARENT_ID | UNIQUE_ID |
| 100 | 100 |
| 100 | 130 |
| 100 | 140 |
| 100 | 120 |
| 100 | 125 |
| 100 | 127 |
| 100 | 128 |
| 200 | 200 |
| 200 | 210 |
| 200 | 215 |
| 300 | 300 |
| 300 | 310 |
| 300 | 315 |
Now what I want to do is group the data with the same parent_id programatically. The ouput should look like this:
| GROUP | PARENT_ID | UNIQUE_ID |
| 1 | 100 | 100 |
| 1 | 100 | 130 |
| 1 | 100 | 140 |
| 1 | 100 | 120 |
| 1 | 100 | 125 |
| 1 | 100 | 127 |
| 1 | 100 | 128 |
| 2 | 200 | 200 |
| 2 | 200 | 210 |
| 2 | 200 | 215 |
| 3 | 300 | 300 |
| 3 | 300 | 310 |
| 3 | 300 | 315 |
Please help or any suggestion how I can do this. Thanks.