Created
July 12, 2022 20:27
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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