crosstab with 2 (or more) row names
问题 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 --------------------------------