A table contains results of a match. Each match is a series of 7-9 games (different leagues share same match schedule table and play different best of "x" matches), such as:
id
teamA
game1
game2
.
.
.
game9
Need to calculate average based on game total and number of games played. Since I can't exactly tell how many games should have results for a given match, I would like to count the number of games whose value is >0. I know I can do this using php and looping through the record, but it would be better to create either a trigger or scheduled event.