By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Records: 5 Duplicates: 0 Warnings: 0
Records: 2 Duplicates: 0 Warnings: 0
| id | daily | daily_remain | parent_id |
|---|---|---|---|
| 1 | 10 | 10 | null |
| 2 | 10 | 5 | 1 |
| 3 | 10 | null | 2 |
| 4 | 10 | 0 | null |
| 5 | 10 | 10 | 4 |
| id | contingent_id |
|---|---|
| 1 | 3 |
| 2 | 5 |
| id | contingent_left |
|---|---|
| 1 | 1 |
| 2 | 0 |