Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MilesDowe/512075b875ad0326e3928a404018874d to your computer and use it in GitHub Desktop.
Save MilesDowe/512075b875ad0326e3928a404018874d to your computer and use it in GitHub Desktop.
Just a simple example of how to use `array_join/distinct/agg` to get a string list of results grouped by a value (in Athena/PrestoDB)
select
customer_id
array_join(array_distinct(array_agg(purchase_id)),'|') as current_purchases_list
from transactions
group by customer_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment