It is difficult to explain, but I will do everything in my power.
I have 2 tables with a many-to-many relationship; there is a link table that defines the relationship. These tables are called Question, QuestionTopic, and Topic. The topic has the fields TopicID and TopicName.Question has the fields QuestionID and QuestionText.
I want to get a list of topics and the number of questions related to this topic. However, topics can be grouped together, and the number of questions unique to this combination should be known. As an example:
Theme | Count
Topic1, Topic2 | ten
Theme1 | 3
Theme2 | 2
It follows from the above that there are 3 questions unique to topic1 and 10, which have topics Topic1 and Topic2. The remaining 2 questions have topic2. I use MySQL and PHP. Thanks.
source share