Looking for a running total of Points, Wins and Losses.
My previous attempt gave running total but did not separate by team.
Presently the running totals (rt and wins, losses) do not work.
I am using pre 2012 mysql
(SELECT 'Week', 'TeamNum', 'Gm1', 'Gm2', 'Gm3','Total', 'rt' ,'Won', 'Lost', 'Wins', 'Losses')
FORMAT( SUM(Gm1),0) AS "Gm1",
FORMAT( SUM(Gm2),0) AS "Gm2",
FORMAT( SUM(Gm3),0) AS "Gm3",
Format(SUM(Gm1)+ SUM(Gm2)+ SUM(Gm3),0) as "Total",
@rt := @rt + Gm1 + Gm2 + Gm3 AS rt ,
Format(SUM(won),0) as "TtlWins",
Format(SUM(lost),0) as "TtlLosses"
FROM b_Scores R
JOIN (SELECT @rt:=0 ) as dummy
ON Week = MatchWk AND TeamNum = MatchTm