Ali3NDaily Ovols vs Claynosaurz Royalty Fees Over Time
    Updated 2023-02-26
    with ovolt as (select * from solana.core.dim_labels where label = 'elixir: ovols'),

    clayt as (select * from solana.core.dim_labels where label = 'claynosaurz'),

    table1 as (
    select tx_id,
    sales_amount
    from solana.core.fact_nft_sales t1
    where mint in (select address from ovolt)
    and T1.succeeded = 'TRUE'
    and sales_amount > 0),

    table2 as (
    select t1.block_timestamp,
    t1.tx_id,
    max(amount),
    sum(amount),
    (sum(amount) - max(amount))/2 as Royalty_Fee
    from solana.core.fact_transfers t1 left outer join table1 t2 on t1.tx_id = t2.tx_id
    where mint = 'So11111111111111111111111111111111111111112'
    and t1.tx_id in (select distinct tx_id from table1)
    group by 1,2),

    table11 as (
    select tx_id,
    sales_amount
    from solana.core.fact_nft_sales t1
    where mint in (select address from clayt)
    and T1.succeeded = 'TRUE'
    and sales_amount > 0),

    table22 as (
    select t1.block_timestamp,
    t1.tx_id,
    max(amount),
    sum(amount),
    Run a query to Download Data