Query editor
withlast_balances as (select*from query_2248971where-- balance > 0evt_block_time = (select max(evt_block_time) as day from query_2248971)and account <> 0x0000000000000000000000000000000000000000),all_accounts as (select distinct account from last_balances),all_labels as (select*from (selecta.account,casewhen q.name is not null then q.namewhen e.ens is not null then array_join(e.ens, ',')when l.address is not null then array_join(l.names, ',')when s.address is not null then 'Safe'else concat(cast(bytearray_substring(a.account, 1, 3) as varchar), '...', substring(cast(bytearray_substring(a.account, 18, 3) as varchar), 3))end as name, case when c.address is not null then true end as is_contract, case when s.address is not null then true end as is_safe, q.is_internal, q.name as manual_name, array_join(l.names, ',') as all_labelsfromall_accounts aleft outer join (select distinct address from labels.contracts where blockchain = 'ethereum') c on a.account = c.addressleft outer join (select distinct address from labels.safe) s on a.account = s.addressleft outer join query_2260391 q on a.account = q.address -- manual labelsleft outer join (select array_agg(name) as ens, address from labels.ens where address in (select account from all_accounts) group by address) eon a.account = e.addressleft outer join(select array_agg(name) as names, address from labels.all where blockchain = 'ethereum' and label_type = 'identifier' and address in (select account from all_accounts) group by address) lon a.account = l.address) wherename is not nullor is_contract is not nullor is_safe is not nullor is_internal is not nullor manual_name is not nullor all_labels is not null)/**,with_pct as (selectb.*,b.balance / sum(b.balance) over () as pct,l.ens-- ,COALESCE(array_join(l.all_labels, ','), cast(account as varchar)) as all_labels,all_labels