By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Records: 2 Duplicates: 0 Warnings: 0
| service_id | service_name | service_limit |
|---|---|---|
| 5 | Sample Service | 5 |
| 8 | Other tool | 2 |
Records: 7 Duplicates: 0 Warnings: 0
| id | service_id | status |
|---|---|---|
| 1 | 5 | 0 |
| 2 | 5 | 0 |
| 3 | 5 | 0 |
| 4 | 8 | 0 |
| 5 | 8 | 0 |
| 6 | 8 | 0 |
| 7 | 8 | 0 |
| service_id | service_name | service_limit | id | status | @service_id := 0 | @row_number := 0 | rownumber | @service_id := service_id |
|---|---|---|---|---|---|---|---|---|
| 5 | Sample Service | 5 | 3 | 0 | 0 | 0 | 1 | 5 |
| 5 | Sample Service | 5 | 2 | 0 | 0 | 0 | 2 | 5 |
| 5 | Sample Service | 5 | 1 | 0 | 0 | 0 | 3 | 5 |
| 8 | Other tool | 2 | 7 | 0 | 0 | 0 | 1 | 8 |
| 8 | Other tool | 2 | 6 | 0 | 0 | 0 | 2 | 8 |