I have a table that lists the name, pins1, pins2, pins3 and gender.
I want to choose the top 20 unique women members with the highest scores. In other words, if the individuals have multiple high scores, only show their name with the highest score. Here is what I have tried.
SELECT name, GREATEST(pins1, pins2, pins3) AS high_score FROM bc_average WHERE gender = 'Women' ORDER BY high_score DESC LIMIT 20
Echos the top scores in decending order but contains duplicate names.
SELECT memberid, name, GREATEST(pins1, pins2, pins3) AS high_score FROM bc_average WHERE gender = 'Women' GROUP BY memberid ORDER BY high_score DESC LIMIT 20
Adding GROUP BY echos unique names but not the member's top scores.
SELECT DISTINCT name, GREATEST(pins1, pins2, pins3) AS high_score FROM bc_average WHERE gender = 'Women' ORDER BY high_score DESC LIMIT 20
DISTINCT name does not eliminate duplicates either.
Any Suggestions???