相关疑难解决方法(0)

如何从 PostgreSQL 中的 jsonb 数组中获取特定对象?

我有一个名为“user”的字段,其中包含一个大致如下所示的 json 数组:

"user"

[{ "_id" : "1", "count" : "4" }, { "_id" : "3", "count": "4"}]
Run Code Online (Sandbox Code Playgroud)

现在我想要一个像这样的查询:

select count from tablename where id = "1"
Run Code Online (Sandbox Code Playgroud)

我无法count从 PostgreSQL 9.4 中的 json 对象数组中获取特定字段。

postgresql array json postgresql-9.4

21
推荐指数
1
解决办法
7万
查看次数

标签 统计

array ×1

json ×1

postgresql ×1

postgresql-9.4 ×1