select team ,sum(points) from
(
select hometeam team, sum(homepoints) points
from fixtures
group by hometeam
union
select awayteam team, sum(awaypoints) points
from fixtures
group by awayteam
)
group by team

select team ,sum(points) from
(
select hometeam team, sum(homepoints) points
from fixtures
group by hometeam
union
select awayteam team, sum(awaypoints) points
from fixtures
group by awayteam
) tmp
group by team