bravo14 Posted March 31, 2017 Share Posted March 31, 2017 Hi I have a mysql query that generates a league table based on wins, losses and draws etc, but also points difference between how many they score and how many are scored against them. The query works except for the points difference part, the offending part of the query is shown below @F:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.homescore,0)) as `F`, @A:=SUM(IF(tbl_clubs.club_id = tbl_fixtures.home,tbl_fixtures.awayscore,0)) + SUM(IF(tbl_clubs.club_id = tbl_fixtures.away,tbl_fixtures.homescore,0)) as `A`, SUM(@F - @A) as `PtsDiff`, Using the code above I am getting NULL as a result even though there should be a figure calculated. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.