Pivoting a table using crosstab() in PostgreSQL
I've got this table in Postgres: create table test("Product id", "Product Name", "Category", "Operator", piece) as values (10, 'Carbonara', 'C1', 'User1', 1) ,(11, 'Spaghetti', 'C1', 'User2', 1) ,(12, 'Coke', 'C2', 'User1', 1) ,(10, 'Carbonara', 'C1', 'User2', 2) ,(11, 'Spaghetti', 'C1',…