By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
id | col1 | col2 | What I want | What you get |
---|---|---|---|---|
1 | x | a | 1 | 1 |
2 | x | b | 2 | 2 |
3 | x | a | 3 | 3 |
4 | x | a | 3 | 3 |
5 | x | c | 4 | 4 |
6 | x | c | 4 | 4 |
7 | x | c | 4 | 4 |
Warning: Null value is eliminated by an aggregate or other SET operation.