I have this query...
SELECT SUM(brownlow_votes) AS votes,
player_id,
player_name,
player_team,
COUNT(*) AS vote_count
FROM afl_brownlow_phantom, afl_playerstats
WHERE player_id=brownlow_player
AND brownlow_match=player_match
GROUP BY player_id
ORDER BY votes DESC LIMIT 50
So "votes" becomes the number of votes a player has, "vote_count" becomes the number of times (matches in which) a player has been voted for. This works fine.
However, I have another column called "brownlow_lock" which is either blank, or 'Y'. How do I get the number of occurances of 'Y'? I know I could solve this changing it to 0 or 1 and just doing a SUM() but I don't want to have to go and edit the tons of pages that are inserting data.