I have three Tables
Countries
id | name
1 | USA
2 | UAE
3 | UK
4 | INDIA
Users
id | name | countryid
1 | Philip| 1
2 | Aby | 3
3 | Sam | 3
Happiness
id | userid | mark
1 | 1 | 10
1 | 2 | 50
1 | 3 | 70
I need to get a result of happiness country ranking as
Rank | Country | Total
1 | UK | 120
2 | UAE | 10
3 | USA | 0
4 | INDIA | 0
I need a mysql query for this solution..