mogarchyUntitled Query
    Updated 2022-12-15
    with tx1 as(select TX_ID,MIN(FROM_ASSET) as FROM_ASSET,MIN(TO_ASSET) as TO_ASSET,count(*)
    FROM thorchain.core.fact_swaps
    WHERE AFFILIATE_ADDRESS = 'te'
    group by TX_ID
    having(count(*))>=2),
    tx2 as(
    select TX_ID,sum(TO_AMOUNT) as AFF_Fee,sum(TO_AMOUNT_USD) as AFF_Fee_USD,min(TO_ASSET) as rn
    FROM thorchain.core.fact_swaps
    WHERE AFFILIATE_ADDRESS = 'te' and TO_ASSET='THOR.RUNE'
    group by TX_ID
    having(count(*))>=2)
    select tx1.TX_ID,tx1.FROM_ASSET,tx1.TO_ASSET,AFF_Fee,AFF_Fee_USD from tx1 join tx2 on tx1.TX_ID=tx2.TX_ID
    Run a query to Download Data