更新时间:2023-02-03 17:06:50
首先使用聚合函数 avg():
SELECT neighborhood, bedrooms, avg(price)
FROM listings
GROUP BY 1,2
ORDER BY 1,2
然后按照相关答案中的详细说明将结果提供给 crosstab()
函数:
Then feed the result to the crosstab()
function as instructed in great detail in this related answer: