Query editor
with outgoing as (select sum(value) / 1e18 as value, "to" as accountfrom erc20_base.evt_Transfer where "from" = 0x86dbd5baae91ac576e8e5197eb2497603d0056eaand contract_address = 0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9group by 2), incoming as (select sum(value) / 1e18 * 0.99 as value, "from" as accountfrom erc20_base.evt_Transferwhere "to" = 0x86dbd5baae91ac576e8e5197eb2497603d0056eaand contract_address = 0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9group by 2), total as (selectincoming.account,(incoming.value - coalesce(outgoing.value, 0)) as balancefromincomingleft joinoutgoing on (incoming.account = outgoing.account))-- Adding total staked amount as the first rowselect 0x0000000000000000000000000000000000000000 as account, sum(balance) as balance from totalwherebalance > 0 andaccount not in (0x2b0a43dccbd7d42c18f6a83f86d1a19fa58d541a)UNION ALL-- Individual balancesselect account, balance from totalwherebalance > 0 andaccount not in (0x2b0a43dccbd7d42c18f6a83f86d1a19fa58d541a)order by balance desc;