Abbas_ra21Other Tokens
    Updated 2023-03-08
    with tb AS (select
    DISTINCT BORROWER_ADDRESS AS BORROWER
    from ethereum.aave.ez_borrows where SYMBOL in ('MKR') and AAVE_VERSION='Aave V2'),
    tb2 AS ( SELECT

    DISTINCT BORROWER_ADDRESS AS BORROWER
    from ethereum.aave.ez_borrows where SYMBOL in ('SNX') and AAVE_VERSION='Aave V2' ),
    tb3 AS (SELECT
    DISTINCT BORROWER_ADDRESS AS BORROWER
    from ethereum.aave.ez_borrows where SYMBOL in ('UNI') and AAVE_VERSION='Aave V2' )
    select
    'MKR' AS B_SYMBOL,
    Symbol,
    sum(BORROWED_USD) AS "Borrowed Amount (USD)"
    from ethereum.aave.ez_borrows where AAVE_VERSION='Aave V2' and BORROWER_ADDRESS in (SELECT BORROWER from tb) and Symbol NOT in ('MKR')
    group by 1,2
    UNION ALL
    select
    'SNX' AS B_SYMBOL,
    Symbol,
    sum(BORROWED_USD) AS "Borrowed Amount (USD)"
    from ethereum.aave.ez_borrows where AAVE_VERSION='Aave V2' and BORROWER_ADDRESS in (SELECT BORROWER from tb2) and Symbol NOT in ('SNX')
    group by 1,2
    UNION ALL
    select
    'UNI' AS B_SYMBOL,
    Symbol,
    sum(BORROWED_USD) AS "Borrowed Amount (USD)"
    from ethereum.aave.ez_borrows where AAVE_VERSION='Aave V2' and BORROWER_ADDRESS in (SELECT BORROWER from tb3) and Symbol NOT in ('UNI')
    group by 1,2
    Run a query to Download Data