, (, otherAliases, count) SQL. , Python, . ,
for otherAlias in otherAliases :
for otherAch in otherAlias.achievements.all() :
r[otherAch] = r.get(otherAch, 0) + 1
.
SQL, , Achiever Alias, , . .
"B" - , "Achiever" - . , "B" , . alias_id , , , .
( SQL)
SELECT B.Alias_id, COUNT(B.achievement_id)
FROM Achiever, Achiever as B
WHERE Achiever.achievement_id == B.achievement_id
AND Achiever.Alias_id == <insert current user alias here>;
GROUP BY B.Alias_id
, , , , .
, , - SQL, , " " - . Achiever . , , 10 , .
, , JOIN , success_id 10 , NULL, " t . , NULL ( ).