【发布时间】:2016-06-30 12:01:32
【问题描述】:
我有一个名为“log_data”的 JSON 类型列,其中存储的数据格式为 [{"key":"test123123","identity":"user@test.it","identity_type":"email"}]。
我想计算json中给定键的给定值的记录数:
不起作用
SELECT count (distinct esas_logs.log_id) AS "count" FROM "esas_logs" WHERE log_data->0->>'identity' = 'user@test.it'
[2016-06-30 13:59:18] [42883] ERROR: operator does not exist: json = unknown
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
【问题讨论】:
-
esas_logs.log_id列的类型是什么?
标签: arrays json postgresql