hbd19941. DeGods
    Updated 2022-10-08
    with maintable as (select
    contract_name,
    a.*,
    TOKEN_METADATA:Background as Background,
    TOKEN_METADATA:Mouth as Mouth,
    TOKEN_METADATA:Neck as Neck
    TOKEN_METADATA:Clothes as jersey,
    TOKEN_METADATA:Specialty as Specialty,
    TOKEN_METADATA:Skin as Skin
    from solana.core.fact_nft_sales a
    left join solana.core.dim_nft_metadata b on a.mint=b.mint
    where CONTRACT_NAME = 'DeGods')

    (select
    'Jersey' as attribute_type,
    jersey as attribute,
    count(*) sale_count
    from maintable
    where attribute not in ('No Traits')
    group by 2
    order by 3 desc)
    UNION
    (select
    'Eyewear' as attribute_type,
    eyewear as attribute,
    count(*) sale_count
    from maintable
    where attribute not in ('No Traits')
    group by 2
    order by 3 desc)
    UNION
    (select
    'Head' as attribute_type,
    head as attribute,
    count(*) sale_count