title: How to get this table in MySQL?
body: <p>I have the following schema:</p>
  
  <p><img src="https://i.stack.imgur.com/u1p8Z.png" alt="enter image description here"></p>
  
  <p>And I want to generate a table with 3 columns - tag's name, thread's name, answers count.</p>
  
  <p>Example:</p>
  
  <pre><code>Foo bar 5
  Foo something 6
  Foo2 somethingElse 3
  </code></pre>
  
  <p>What's more, there's a table "priority_threads" (1:1 with threads). I want to display only those priority threads in this table.</p>
  
  <p>How can I do this? I have absolutely no idea how to even start. The only thing I did is:</p>
  
  <pre><code>SELECT tag.name, thread.title, COUNT(answer.id_answer)
  FROM tag, thread, answer
  WHERE thread.id_tag = tag.id_tag 
  AND answer.id_thread = thread.id_thread
  AND thread.id_thread = priority_threads.id_thread
  GROUP BY tag.name, thread.title
  ORDER BY tag.name;
  </code></pre>
  
  <p>However using this query all values in the answer's count column are the same - count(*) from Answer table...</p>