I have my current sql query which I will later convert to a HIVE query.
SELECT home_team, COUNT(home_team)
from results
WHERE results.home_score < results.away_score
GROUP BY home_team
UNION
SELECT away_team, COUNT(away_team)
FROM results
WHERE results.away_score < results.home_score
GROUP BY away_team
And it currently returns two occurrences of a country, once as a home_team and once as an away_team. Current results
How can I modify this query so it adds the count(home_team) and makes the country only appear once? Ex. Argentina : 50
I've tried to put both select queries in brackets and then count the sum being returned but I seem to always get an error when I do order by.