Suppose I have a table named Billionaires
having attributes Country
, Name
, Net Worth
, of billionaire individuals from every country.
I want the top 10 individuals from every country having the highest net worth with their net worth summed up.
The sample output is like
Country | TotalNetworth |
---|---|
US. | 500000000000 |
India. | 300000000000 |
And so on.
My code that I tried:
Select Country, Sum(NetWorth) over (partition by country) as TotalNetworth
From Billionaires