I'm trying to figure out how to get a specific users rank depending on the users average points, but with no luck...

Here is what I have tried:
$sql = mysql_query("SELECT COUNT(*) rank FROM ".$prefix."_users WHERE average_points > (SELECT points/played AS average_points FROM ".$prefix."_users WHERE id = $currplayer) AND played > 24") or die (mysql_error());
This can not be done due to the average_points is set within the second SELECT... What to do?

Thanks in advance.