I have a postgres table that looks something like this:
cust_id key value
---------------------
1 A 10
1 B 20
1 C 30
2 A 1
2 B 2
2 C 3
2 D 4
2 E 5
3 D 100
3 F 200
I want to write a query that will give me a table grouped by cust_id like so:
cust_id A B C D E F
-------------------------------------------
1 10 20 30 NULL NULL NULL
2 1 2 3 4 5 NULL
3 NULL NULL NULL 100 NULL 200
I was thinking of using partitions, but I'm having trouble designing the query. Any idea on how to do this?