Skip to content
Advertisement

how to Join array with string in Snowflake

I have two tables:

Books with column tag_ids (Array)

Tags with column tag_id (Varchar)

I have a visualisation tool that need to join these tables together. The only thing that I can control over is the join condition. the problem is that I can’t find a way to make this join work.

this is what I tried:

This works only on array with one element. It will not work for cases like:

tag_ids =

tag_id =

Tried to do:

I don’t know if this works but it does certisian product and takes 15+ to run so I can’t use this anyway.

What I’m looking for is basically to ask

I’m sure there is a simple solution for that.

Advertisement

Answer

You want to use the array_contains function.

See the docs here.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement