postgresql jsonb解析属性,并查询、排序;
1. other_name字段示例
[{"title": "BQ Product", "value": "aValue"}, {"title": "CTB Product", "value": "bValue"}]
2. 查询
select (other_name->0) from dim_product_mapping
select (other_name->0)::jsonb->'title' from dim_product_mapping
select (other_name->0)::jsonb->'value' from dim_product_mapping
3. 排序
select * from dim_product_mapping where 1=1 order by (other_name->0)::jsonb->'value',update_time desc limit 12 offset 0
注意:是jsonb,不是json