with lst_top_2022 as (
select top 100
address as wallet
,sum(balance/pow (10,decimal)) as balances
from osmosis.core.fact_daily_balances
where date='2022-01-01'
and currency = 'uosmo'
group by 1
order by 2 desc
)
,lst_top_CURRENT as (
select top 100
address as wallet
,sum(balance/pow (10,decimal)) as balances
from osmosis.core.fact_daily_balances
where date=CURRENT_DATE-1
and currency = 'uosmo'
group by 1
order by 2 desc
)
select
wallet
,balances
from lst_top_CURRENT
where wallet in(select wallet from lst_top_2022)
order by balances desc