Is it possible to do a pivot table on the result of a SQL query? For example, I create a new question using the UI on the sample dataset to get from Orders “Count of rows by Product > Category and User > State”. I format as a table and I get a nice pivot, with one column per product category.
However, if I try to do this in SQL, I just get the three columns directly from my query.
select category, state, count(*) from orders o join products p on p.id = o.product_id join people pp on o.user_id = p.id group by category,state