Query editor
withactive_lockers as (select evt_tx_from as address, sum(value/1e18) as locked_amount, max(from_unixtime(lockTime)) as lock_expiration from jooce_base.votingescrow_evt_depositgroup by evt_tx_fromhaving max(from_unixtime(lockTime)) > now()),active_stakers as (select address , sum(value) as balance from(select evt_tx_from as address, value/1e18 as value from jooce_base.staking_evt_depositunion allselect evt_tx_from as address, -value/1e18 as value from jooce_base.staking_evt_withdraw)group by addresshaving sum(value) > 0order by sum(value) desc)select address, balance as jmx_staked, locked_amount as jooce_locked from(select address, balance from active_stakers) afull join(select address, locked_amount from active_lockers) busing (address)where balance > 5000 or locked_amount > 50_000_000