granadoho5 most popular swaps on Jupiter (SOL -> another coin)
    Updated 2022-03-16
    with program_id as (
    select * from solana.labels where label = 'jupiter' or label = 'orca'
    ), tx_list as (
    select
    a.tx_id,
    b.label
    from solana.transactions a
    inner join program_id b
    on b.address = a.program_id
    where a.block_timestamp::date >= '2022-01-01'
    and lower(a.program_id) in (select lower(address) as address from program_id)
    ), swaps as (
    select
    a.*,
    b.label
    from solana.swaps a
    inner join tx_list b
    on a.tx_id = b.tx_id
    where a.swap_from_amount != 0
    and a.swap_to_amount !=0
    and a.tx_id in (select tx_id from tx_list)
    and a.swap_from_mint != a.swap_to_mint
    and a.swap_from_mint = 'So11111111111111111111111111111111111111112'
    )

    Select
    a.swap_to_mint,
    b.address_name,
    count(distinct a.tx_id) as swapcount
    From swaps a
    LEFT OUTER JOIN Solana.labels b
    ON lower(b.address) = lower(a.swap_to_mint)
    Where a.block_timestamp::date >= '2022-01-01'
    And a.succeeded = 'True'
    And a.label = 'jupiter'
    Group by 1,2
    Run a query to Download Data