Vous pouvez essayer la requête ci-dessous -
SELECT P.name, A.value, V.CNT_VOTES total_votes
FROM properties P
INNER JOIN assignments A ON P.id = A.property_id
INNER JOIN (SELECT assignment_id, COUNT(*) CNT_VOTES
FROM votes
GROUP BY assignment_id) V ON V.assignment_id = A.id
LEFT JOIN flags F ON F.assignment_id = A.id
AND F.assignment_id IS NULL
ORDER BY V.CNT_VOTES DESC
LIMIT 1;