select
World_Cup_Type,
Rank,
NFTs_Count
from
(
select address,
World_Cup_Type,
count (distinct nft_asset_id) as NFTs_Count,
RANK() OVER (partition by World_Cup_Type ORDER BY NFTs_Count desc) as rank
from algorand.core.fact_account_asset t1 join algorand.nft.ez_nft_metadata_fifa t2 on t1.asset_id = t2.nft_asset_id
where t1.amount > 0
group by 1,2
)
where address ilike '{{Wallet_Address}}'
order by Rank