mo1152023-03-08 10:32 PM
    Updated 2023-03-08
    with f as (select date_trunc ('day', BLOCK_TIMESTAMP) as Day,
    case when NODE_DATA:follow is not null then 'Follow'
    else null
    end as Follows
    from near.social.fact_decoded_actions
    where Day >= CURRENT_DATE - 5
    ),
    u as (select date_trunc ('day', BLOCK_TIMESTAMP) as Day,
    case when NODE_DATA:Unfollow is not null then 'Unfollow'
    else null
    end as Unfollows
    from near.social.fact_decoded_actions
    where Day >= CURRENT_DATE - 5 )
    select u.DAY,
    count (Follows) ,
    count (Unfollows)
    from f f join u u on f.day = u.day
    group by 1