By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Records: 5 Duplicates: 0 Warnings: 0
| id | if (p.id is null, 'Root', if (d.id is null, 'Leaf', 'Inner')) |
|---|---|
| 1 | Root |
| 2 | Inner |
| 3 | Leaf |
| 4 | Leaf |
| 5 | Leaf |
| result |
|---|
| result |
|---|
Records: 5 Duplicates: 0 Warnings: 0
| id | if (p.id is null, 'Root', if (d.id is null, 'Leaf', 'Inner')) |
|---|---|
| 1 | Root |
| 2 | Inner |
| 3 | Leaf |
| 4 | Leaf |
| 5 | Leaf |
| result |
|---|
| result |
|---|