Postgres JSONB数组查询

时间:2019-04-21 23:09:45

标签: jsonb postgresql-9.4

当我表中的jsonb字段包含这种格式的json时,如何使用jsonb查询函数从整个表中获取匹配的TrackingDetails?例如,我有一个order_events表,其中包含名为event_data的列,其中将包含以下json:

{
  "Responses": [
    {
      "Response": {
        "TrackingDetails": {
          "IntegrationId": "IntegrationId",
          "MessagePart": 0,
          "MessageTotal": 0,
          "MessageGroupId": "MessageGroupId",
          "SequenceNumber": "SequenceNumber",
          "InterfaceRecordId": "InterfaceRecordId",
          "SalesOrderNumber": "SalesOrderNumber",
          "SalesOrderReference": "SalesOrderReference",
          "DispatchNumber": "DispatchNumber",
          "Courier": "Courier",
          "TrackingNumber": "TrackingNumber",
          "TrackingUrl": "TrackingUrl"
        }
      }
    }
  ]
}

我想通过TrackingNumber在表的所有行中将TrackingDeatils作为Json节点。它包括多个匹配的行。谢谢你的帮助。

0 个答案:

没有答案