I've used crosstab function and ended up with a table that has a single column value on each row.
| ID | c1 | c2 | c3 |
-----------------------------
| 1 | | 1 | |
| 1 | 4 | | |
| 1 | | | 12 |
| 15 | 2 | | |
| 15 | | | 3 |
and want to change it so that the ID is distinct and all values are on the same row:
| ID | c1 | c2 | c3 |
-----------------------------
| 1 | 4 | 1 | 12 |
| 15 | 2 | | 3 |
What is the best way to do this? I could use an aggregate function like SUM
and GROUP BY id
but that makes pointless calculations that aren't required.