phu[Solana] Realms DAO - first and last date using Realms by DAO
    Updated 2022-08-17
    select
    address_name,
    min(date) first_date,
    max(date) last_date,
    datediff(day, first_date, last_date) days
    from (
    select
    case
    when address_name ilike '%metaplex%' then 'metaplex'
    when realms_id = 'By2sVGZXwfQq6rAiAM3rNPJ9iQfb5e2QhnF4YjJ4Bip' then 'grape dao'
    when realms_id = '6orGiJYGXYk9GT2NFoTv2ZMYpA6asMieAqdek4YRH2Dn' then 'the imperium of rain dao'
    when realms_id = '7oB84bSuxv9AH1iRdMp5nFLwpQApv8Yo9s1gGmDkHtSP' then 'synthetify dao'
    else address_name
    end address_name,
    date(block_timestamp) date
    from solana.core.fact_proposal_votes a
    left join solana.core.dim_labels b on a.PROGRAM_NAME = b.address
    where succeeded
    and governance_platform = 'realms'
    and (
    address_name in ('mango dao','monkedao','jet dao','solend dao','psy finance','serum')
    or address_name ilike '%metaplex%'
    or realms_id in ('By2sVGZXwfQq6rAiAM3rNPJ9iQfb5e2QhnF4YjJ4Bip','6orGiJYGXYk9GT2NFoTv2ZMYpA6asMieAqdek4YRH2Dn','7oB84bSuxv9AH1iRdMp5nFLwpQApv8Yo9s1gGmDkHtSP')
    )
    )
    group by 1
    order by 2
    Run a query to Download Data