with f as (select * from UNNEST([1, 3,8,9,13,23, 5, 4, 23,55,77,6]) as fruit ) SELECT *, STRING_AGG(cast(fruit as string), " , ") OVER (ORDER BY fruit ROWS BETWEEN 0 FOLLOWING AND 3 FOLLOWING) as click_history FROM f where fruit>4 ;