Skip to content

Instantly share code, notes, and snippets.

@oeon
Created January 7, 2020 05:59
Show Gist options
  • Save oeon/e79343ed661a76eeb544e4f239059c61 to your computer and use it in GitHub Desktop.
Save oeon/e79343ed661a76eeb544e4f239059c61 to your computer and use it in GitHub Desktop.
unnested photo array - captions...aggregated back together
select _record_id, string_agg(unnest, ', ') as photos, string_agg(photos_captions, ', ') as photos_captions from (select r._record_id, r.unnest, k.labels as photos_captions from records r join rek k on k.photo = r.unnest order by _record_id) a group by _record_id order by _record_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment