Jump to content

runnerjp2003

New Members
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About runnerjp2003

  • Rank
    Newbie
  1. runnerjp2003

    Football League Table - Last 5 matches

    Hi all, Does anyone know how I could alter the MYSQL code to select the last 5 games each Team has played to create a table of using the last 5 games to show current form? My current code is as follows: select team, count(*) played, count(case when scor1 > scor2 then 1 end) wins, count(case when scor2> scor1 then 1 end) lost, count(case when scor1 = scor2 then 1 end) draws, sum(scor1) scor1, sum(scor2) scor2, sum(scor1) - sum(scor2) goal_diff, sum( case when scor1 > scor2 then 3 else 0 end + case when scor1 = scor2 then 1 else 0 end ) score from ( select txtechipa1 team, scor1, scor2 from footballtest INNER JOIN Leagues ON LEFT(footballtest.codmeci, 4) = Leagues.code where Leagues.Code = '0101' and footballtest.sezonul = '19' and datameci < CURDATE() union all select txtechipa2, scor2, scor1 from footballtest INNER JOIN Leagues ON LEFT(footballtest.codmeci, 4) = Leagues.code where Leagues.Code = '0101' and footballtest.sezonul = '19' and datameci < CURDATE() ) a group by team order by score desc , goal_diff
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.