小编Bax*_*Bax的帖子

如何取消嵌套和 GROUP BY JSON 数组的元素?

给定band表格,其中一json列包含一个数组:

id | people
---+-------------
1  | ['John', 'Thomas']
2  | ['John', 'James']
3  | ['James', 'George']
Run Code Online (Sandbox Code Playgroud)

如何列出每个名称所属的乐队数量?
期望的输出:

name   | count
-------+------------
John   | 2
James  | 2
Thomas | 1
George | 1
Run Code Online (Sandbox Code Playgroud)

postgresql group-by array json

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

array ×1

group-by ×1

json ×1

postgresql ×1