jsonb_array_elements()在横向联接中使用的次数与要比较的json数组的深度一样多:
select schools->>'school_id' school_id, addresses->>'addr_id' addr_id, addresses->>'house_description' house_description, addresses->>'house_no' house_nofrom title_register_data,jsonb_array_elements(address_data->'schools') schools,jsonb_array_elements(schools->'addresses') addresseswhere addresses->>'house_description' = addresses->>'house_no'; school_id | addr_id | house_description | house_no -----------+---------+-------------------+---------- 1 | 4 | 1 | 1(1 row)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)