Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 387 Bytes

filtering-arrays.md

File metadata and controls

18 lines (14 loc) · 387 Bytes

Filtering arrays

Explore this snippet with some demo data here.

Description

To filter arrays in Snowflake you can use a combination of ARRAY_AGG and FLATTEN:

select
  array_agg(value) as filtered
from (select array_construct(1, 2, 3, 4) as x),
lateral flatten(input => x)
where value <= 3
FILTERED
[1,2,3]