I have a select statement in a php script which does something similar. It select the number of "wins" from a "matches" table from a database including league tennis results and prints them out in an echo statement as a percentage.
$query= "SELECT (SUM(if(W_L='w', 1,0)) / COUNT(*) * 100) FROM matches";
The above only has two options, w or l so the if probably won't work in your case and you will obviously need to use some trial and error to modify it. I found this online somewhere and modified it until it worked. Not being a programmer, I would not be able to explain why this works, but it does. Unfortunately, I haven't a clue about what specifically you could do to get it working in your case. Good luck!