I'm trying to transpose a table which has 2 row names.
Postgres documentation mentions the crosstab()
function being able to only handle 1 row name, but I have 2 row names, like first name and last name.
my intital table is:
fn | ln | file_type |attribute
--------------------------------
A | 1 | cat1 |abc
A | 2 | cat1 |gth
A | 1 | cat2 |fgh
B | 1 | cat2 |gth
and I want my final table to be with 2 initial rows and the file_type transposed
fn | ln | cat1 | cat2
--------------------------------
A | 1 | abc | fgh
A | 2 | gth |
B | 1 | | gth
I have not been able to find what I need in functools ...
version is Postgres 9.3