with top100firstmonths as (
SELECT
DISTINCT address as user,
sum(balance/pow(10,6)) as balance
FROM osmosis.core.fact_daily_balances
WHERE CURRENCY = 'uosmo'
AND date>= '2022-01-01' and date <= '2022-03-01'
group by 1
order by 2 desc
limit 100),
currenttop100 as (
SELECT
DISTINCT address as user,
sum(balance/pow(10,6)) as balance
FROM osmosis.core.fact_daily_balances
WHERE CURRENCY = 'uosmo'
AND date>= '2022-01-01'
group by 1
order by 2 desc
limit 100)
select b.user,b.balance from top100firstmonths a join currenttop100 b on a.user=b.user