Q:

Mysql arithmetic

I have the following code which goes through a table that has a table name and numbers for each row
For example
Barcelona | 3 | Milan   | 6
Inter     | 6 | Chelsea | 2
Barcelona | 8 | Madrid  | 2
Inter     | 2 | Parma   | 1

With the following code I want my result to be 
Barcelona 11 8 3
Inter 8 3 5

So I get the goals scored the goals against and the difference however my query works for the first row but it doesn't take the difference in the second row
SELECT
    c.team1, 
    SUM(c.team1score) as GF,
    SUM(c.team2score) as GA,
    (c.team1score-c.team2score) as GD
FROM calendario AS c
GROUP BY c.team1

Why is this happening??

A:

Your question is not very clear but maybe you need only to take difference between the two SUM values, like in this way : 
 SELECT c.team1, sum(c.team1score) as GF, sum(c.team2score) as GA, (sum(c.team1score)-sum(c.team2score)) as GD
 FROM calendario c
 group by c.team1

