Query editor
WITH deposit as (SELECT"from" as addr,-- COUNT(*) AS txs,SUM(value) / 1e18 AS deposit_amount,MIN(evt_block_time) as first_depositFROM erc20_ethereum.evt_transferWHERE contract_address = 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3AND to = 0x90d2af7d622ca3141efa4d8f1f24d86e5974cc8f and value > 0GROUP BY 1),withdraw as (SELECT"to" as addr,-- COUNT(*) AS txs,SUM(value) / 1e18 AS withdraw_amountFROM erc20_ethereum.evt_transferWHERE contract_address = 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3AND "from" = 0x90d2af7d622ca3141efa4d8f1f24d86e5974cc8f and value > 0GROUP BY 1)selectrow_number() over(order by deposit_amount - coalesce(withdraw_amount, 0) desc) as rk,addr,deposit_amount - coalesce(withdraw_amount, 0) as total_amount,deposit_amount,coalesce(withdraw_amount, 0) as withdraw_amount,row_number() over(order by deposit_amount - coalesce(withdraw_amount, 0) asc) as numsfrom depositleft join withdraw using(addr)order by 3 desc