SELECT TOP (5) mydb.Te.TeamGR AS TeamInGR, Te_1.TeamGR, SUBSTRING(mydb.Data.AkrivesSkor, 1, 1) AS GoalsIn, SUBSTRING(mydb.Data.AkrivesSkor, 3, 1)
AS GoalsOut
FROM mydb.Te INNER JOIN
mydb.Data ON mydb.Te.TeamID = mydb.Data.TeamInID INNER JOIN
mydb.Diorganoseis ON mydb.Data.DioID = mydb.Diorganoseis.DioID INNER JOIN
mydb.Te AS Te_1 ON mydb.Data.TeamOutID = Te_1.TeamID
GROUP BY mydb.Te.TeamGR, mydb.Diorganoseis.DioGR, mydb.Diorganoseis.DioEN, Te_1.TeamGR, mydb.Data.DataID, mydb.Data.Hmerominia,
SUBSTRING(mydb.Data.AkrivesSkor, 1, 1), SUBSTRING(mydb.Data.AkrivesSkor, 3, 1)
HAVING (mydb.Te.TeamGR = N'ΜΠΙΛΕΦΕΛΝΤ') OR
(Te_1.TeamGR = N'ΜΠΙΛΕΦΕΛΝΤ')
ORDER BY mydb.Data.DataID DESC
The above view, produces this output. It feches the last six games of the team ΜΠΙΛΕΦΕΛΝΤ with the goals scored.
TeamInGR TeamGR GoalsIn GoalsOut
ΑΟΥΓΚΣΜΠΟΥΡΓΚ ΜΠΙΛΕΦΕΛΝΤ 3 1
ΜΠΙΛΕΦΕΛΝΤ ΚΟΜΠΛΕΝΤΖ 4 2
ΧΑΝΣΑ ΡΟΣΤΟΚ ΜΠΙΛΕΦΕΛΝΤ 1 1
ΟΜΠΕΡΧΑΟΥΖΕΝ ΜΠΙΛΕΦΕΛΝΤ 0 0
ΜΠΙΛΕΦΕΛΝΤ ΟΥΝΙΟΝ ΒΕΡΟΛΙΝΟΥ 1 1
How should i modify this view, in order getting the sum of goals that the Team ΜΠΙΛΕΦΕΛΝΤ scored?
For example I would like to produce an output like this one...
Team TotalGoals
ΜΠΙΛΕΦΕΛΝΤ 9