with tokens as (
select
ADDRESS,AMOUNT,ASSET_ID,ASSET_NAME
from flipside_prod_db.algorand.account_asset
where ASSET_NAME like any ('%Octo Prime Gen%','%Octorand%')
and ASSET_CLOSED = false
and AMOUNT > 0
)
select
address,
count(asset_id) as num ,
case when asset_name like '%Octorand%' then 'Gen1' else 'Gen2' end as type
from tokens
group by address, type