title: MySQL query with COUNT and join column from another table
body: <p>I have 2 tables with multiple fields.</p>
  
  <p>Table1:</p>
  
  <pre><code>+--------+---+---------------+                                                  
  | month  | id| VERDICT_id    |                                                  
  +--------+------+------------+                                                  
  | 201307 | 1 |             1 |                                                  
  | 201307 | 2 |             4 |                                                  
  | 201307 | 3 |             2 |                                                  
  | 201307 | 4 |             2 |                                                  
  | 201307 | 5 |          NULL |                                                  
  | 201307 | 6 |             1 |                                                  
  +--------+------+------------+
  </code></pre>
  
  <p>Like this for every new 'month', for each unique 'id' the 'VERDICT_ID' is set according to the value in Table2.</p>
  
  <p>Table2:</p>
  
  <pre><code>+----+----------------------------------+
  | id | title                            |
  +----+----------------------------------+
  |  1 | Passed                           |
  |  2 | Failed (Component Fault)         |
  |  3 | Failed (User Fault)              |
  |  4 | Failed (Hardware Issue)          |
  +----+----------------------------------+
  </code></pre>
  
  <p>I make a query which gives below output </p>
  
  <p>Actual Output:</p>
  
  <pre><code>+--------+------------+----------+
  | month  | VERDICT_id | COUNT(*) |
  +--------+------------+----------+
  | 201307 |          1 |        2 |
  | 201307 |          2 |        2 |
  | 201307 |          4 |        1 |
  +--------+------------+----------+
  </code></pre>
  
  <p>What I want is,</p>
  
  <pre><code>+--------+------------+----------+
  | month  | VERDICT_id | COUNT(*) |
  +--------+------------+----------+
  | 201307 |          1 |        2 |
  | 201307 |          2 |        2 |
  | 201307 |          3 |        0 |
  | 201307 |          4 |        1 |
  +--------+------------+----------+
  </code></pre>
  
  <p>The difference between these 2 output is, if any VERDICT_id doesn't exist for a month, then I want to print the VERDICT_id and COUNT as '0'.</p>
  
  <p>But with the below query it's not possible.</p>
  
  <pre><code>select month,VERDICT_id, COUNT(*) FROM Table1 
  where (month = 201307) AND (VERDICT_id BETWEEN 1 AND 4) GROUP BY month, VERDICT_id;
  </code></pre>
  
  <p>Q. Is this possible to make query to print the non existing VERDICT_id and COUNT as '0'?</p>