Updated 2024-01-01
    with
    q1 as (
    SELECT
    CASE when protocol ilike '%GMX%' then 'GMX'
    when protocol ilike '%Joe%' then 'Trader Joe'
    when protocol ilike '%VaporDex%' then 'VaporDex'
    when protocol ilike '%Uniswap%' then 'Uniswap'
    when protocol ilike '%SushiSwap%' then 'SushiSwap'
    when protocol ilike '%KyberSwap%' then 'KyberSwap'
    when protocol ilike '%Balancer V2%' then 'Balancer'
    when protocol ilike '%AAVE%' then 'AAVE'
    when protocol ilike '%Chainlink%' then 'Chainlink'
    else protocol end as platform,
    sum(revenue) as "Q1 2023"
    FROM external.defillama.fact_protocol_fees_revenue
    WHERE date BETWEEN '2023-01-01' AND '2023-04-01'
    AND chain = 'avalanche' AND protocol != 'Avalanche' AND protocol != 'avalanche'
    GROUP by 1
    )
    ,
    q2 as (
    SELECT
    CASE when protocol ilike '%GMX%' then 'GMX'
    when protocol ilike '%Joe%' then 'Trader Joe'
    when protocol ilike '%VaporDex%' then 'VaporDex'
    when protocol ilike '%Uniswap%' then 'Uniswap'
    when protocol ilike '%SushiSwap%' then 'SushiSwap'
    when protocol ilike '%KyberSwap%' then 'KyberSwap'
    when protocol ilike '%Balancer V2%' then 'Balancer'
    when protocol ilike '%AAVE%' then 'AAVE'
    when protocol ilike '%Chainlink%' then 'Chainlink'
    else protocol end as platform,
    sum(revenue) as "Q2 2023"
    FROM external.defillama.fact_protocol_fees_revenue
    WHERE date BETWEEN '2023-04-01' AND '2023-07-01'
    AND chain = 'avalanche' AND protocol != 'Avalanche' AND protocol != 'avalanche'
    QueryRunArchived: QueryRun has been archived