saeedmzn2024-06-13 07:38 PM
    Updated 2024-06-13
    with test_1 as (select
    -- count (tx_hash),
    -- count (DISTINCT tx_hash)
    tx_hash,
    max (amount_usd) max_
    -- case when platform ilike '%aave%' then 'AAVE'
    -- when platform ilike '%joe%' then 'Trader Joe'
    -- else platform end as platform_name,
    -- token_symbol as market,
    -- sum (amount_usd) as repayment_volume
    --sum (case when token_symbol ilike '%usd%' or token_symbol ilike '%dai%' or token_symbol ilike '%frax%' or token_symbol ilike '%mim%' then amount else amount_usd end) as repayment_volume
    from avalanche.defi.ez_lending_repayments
    where token_symbol = 'WBTC.e'
    -- and platform ='Benqi'
    -- order by 1 limit 200
    group by 1
    ),
    test_2 as (select
    -- count (tx_hash),
    -- count (DISTINCT tx_hash)
    tx_hash,
    amount_usd
    -- case when platform ilike '%aave%' then 'AAVE'
    -- when platform ilike '%joe%' then 'Trader Joe'
    -- else platform end as platform_name,
    -- token_symbol as market,
    -- sum (amount_usd) as repayment_volume
    --sum (case when token_symbol ilike '%usd%' or token_symbol ilike '%dai%' or token_symbol ilike '%frax%' or token_symbol ilike '%mim%' then amount else amount_usd end) as repayment_volume
    from avalanche.defi.ez_lending_repayments
    where token_symbol = 'WBTC.e'
    -- and platform ='Benqi'
    -- order by 1 limit 200
    -- group by 1
    )
    -- group by 1,2
    select sum (max_) amount, 'removed_duplicate' type from test_1
    QueryRunArchived: QueryRun has been archived