on-internet
← Community

How to replace array of strings with IDs from another table?

Stack Overflow ·

table 1: id arr 100 ["a","c","b"] 200 ["d","e","c","a"] table 2: letter id a 1 b 2 c 3 d 4 e 5 I need : id id_arr 100 [1,3,2] 200 [4,5,3,1] In Snowflake how to achieve this? I need to preserve order of strings as well. FLATTEN to split array into rows, joining to the other table and back to an array using array_agg doesn't preserve order of array elements.

Comments

Sign in or sign up to comment and upvote.

No comments yet.