I would like to in SQL Server to sum values from two different columns and grouping by team, but I'm not getting too much success.
Here's an example of the data:
And on the above image, how i would like it to be summed.
Here's the code I've written so far:
Select
Fut.HomeTeam As Equipa,
Sum(Fut.FTHG) As Golos
From
Database Fut
Group By
Fut.HomeTeam
Union All
Select
Fut.AwayTeam As Equipa,
Sum(Fut.FTAG) As Golos
From
Database Fut
Group By
Fut.AwayTeam
Order By
Golos Desc

