从jsonb第12页获取多个键/值对

问题描述

Postgres 12

table_1:
  id int,attributes jsonb,layer_id int -- foreign key
table_2:
  id int,labels jsonb,-- this is an array,and its elements correspond to some of the keys in table_1.attributes
  layer_id int -- foreign key

layer_id = layer_id上加入这些表之后,我只想从table_1中选择键/值对。与table_2.labels中的键匹配的属性

例如,如果我们有table_1这样的行:

attributes: { "a": 1,"b": 3,"c": "hello" },layer_id: 5

和table_2这样的行:

labels: '["a","c"]',layer_id: 5

我的目标是获得包含{ "a": 1,"c": "hello" }

的列

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)