title: How to show all months in year regardless if there is a data per month in MySQL
body: <p>I have a table <code>view_remit</code> with a list of ID and their respective <code>total_PBR</code> every first of the month(E_FROM) till the end of the month (E_TO).</p>
  
  <pre><code>|  ID  |  E_From  |   E_To   |Total_PBR|
  |  01  |01/01/2016|03/31/2016|  1000   |
  |  01  |08/01/2016|08/31/2016|  1000   |
  |  02  |01/01/2016|01/31/2016|  3000   |
  |  02  |02/01/2016|02/29/2016|  3000   |
  </code></pre>
  
  <p>What i want is to select all months with and without payment per ID. Like this example below.</p>
  
  <pre><code>|  ID  |  E_From  |   E_To   |Total_PBR|
  |  01  |01/01/2016|01/31/2016|  1000   |
  |  01  |02/01/2016|02/29/2016|  1000   |
  |  01  |03/01/2016|03/31/2016|  1000   |
  |  01  |04/01/2016|04/30/2016|    0    |
  |  01  |05/01/2016|05/31/2016|    0    |
  |  01  |06/01/2016|06/30/2016|    0    |
  |  01  |07/01/2016|07/31/2016|    0    |
  |  01  |08/01/2016|08/31/2016|  1000   |
  |  01  |09/01/2016|09/30/2016|    0    |
  |  01  |10/01/2016|10/31/2016|    0    |
  |  01  |11/01/2016|11/30/2016|    0    |
  |  01  |12/01/2016|12/31/2016|    0    |
  </code></pre>
  
  <p>I used this code from another question here <a href="https://stackoverflow.com/questions/27600863/mysql-monthly-sale-of-last-12-months-including-months-with-no-sale">MySQL monthly Sale of last 12 months including months with no Sale</a></p>
  
  <pre><code>SELECT ID, 
  IF( MONTH( E_From ) =  1, Total_PBR, 0 ) AS  'Jan', 
  IF( MONTH( E_From ) =  2, Total_PBR, 0 ) AS  'Feb', 
  IF( MONTH( E_From ) =  3, Total_PBR, 0 ) AS  'Mar', 
  IF( MONTH( E_From ) =  4, Total_PBR, 0 ) AS  'Apr', 
  IF( MONTH( E_From ) =  5, Total_PBR, 0 ) AS  'May', 
  IF( MONTH( E_From ) =  6, Total_PBR, 0 ) AS  'Jun', 
  IF( MONTH( E_From ) =  7, Total_PBR, 0 ) AS  'Jul', 
  IF( MONTH( E_From ) =  8, Total_PBR, 0 ) AS  'Aug', 
  IF( MONTH( E_From ) =  9, Total_PBR, 0 ) AS  'Sep', 
  IF( MONTH( E_From ) =  10, Total_PBR, 0 ) AS 'Oct', 
  IF( MONTH( E_From ) =  11, Total_PBR, 0 ) AS 'Nov', 
  IF( MONTH( E_From ) =  12, Total_PBR, 0 ) AS 'Dec', year(E_FROM) AS Year,
  SUM(Total_PBR ) AS total_yearly
  FROM view_remit
  GROUP BY PEN, YEAR( E_From )
  LIMIT 0 , 30
  </code></pre>
  
  <p>It worked but it doesn't count some of the months' total_PBR correctly.
  Any help is appreciated. </p>