Solución de "trampa", usando GROUP_CONCAT()
. Esto no mostrará el recuento de preguntas que no están relacionadas con ningún tema:
SELECT
TopicIds
, COUNT(*) AS QuestionCount
FROM
( SELECT
QuestionId
, GROUP_CONCAT(TopicId ORDER BY TopicId) AS Topics
FROM
QuestionTopic
GROUP BY
QuestionId
) AS grp
GROUP BY
Topics