title: How to fill data for missing months for more than 1 year
body: <p>I have a report which displays month wise data from project start till the current month for a set of projects. When a project does not have data for few months it is not getting displayed.</p>
  
  <p>I need to display the missing month rows for each project and show 0 for those rows.</p>
  
  <p>There can be 2 or more projects (like 100 projects) for which the report is generated.The project start can be from earlier years like 2014 also.
  Suppose the current month is Apr 2016.Then the report needs to display data from 201401 till 201604. In the example below i am using the project start month as 201512.</p>
  
  <p>All the list of Months is stored in a Months table which contains all the months. The project start month (201512 and current month 201604 is passed to the storedprocedure as parameters)</p>
  
  <p>At present the report looks like this</p>
  
  <pre><code>=====================================
  |ProjectNo | Period | Billing | WIP  |
  ======================================
  |000123    |201512  | 100      | 75  |  
  |          |201601  | 200      | 100 | 
  --------------------------------------
  |000145    |201512  | 100      | 75  |
  |          |201601  | 200      | 100 |
  |          |201602  | 250      | 110 |    
  |          |201604  | 550      | 110 |
  ======================================
  </code></pre>
  
  <p>The dataset returned looks like this (lets call the resultset as ProjectReportData)</p>
  
  <pre><code>=====================================
  |ProjectNo | Period | Billing | WIP  |
  ======================================
  |000123    |201512  | 100      | 75  |  
  |000123    |201601  | 200      | 100 | 
  |000145    |201512  | 100      | 75  |
  |000145    |201601  | 200      | 100 |
  |000145    |201602  | 250      | 110 |    
  |000145    |201604  | 550      | 110 |
  ======================================
  </code></pre>
  
  <p>As you can see the 201602,201603 and 201604 are missing for Project No 000123.
  For Project No 000145 , 201603 month is missing.</p>
  
  <p>The expected output is like this</p>
  
  <pre><code>=====================================
  |ProjectNo | Period | Billing | WIP  |
  ======================================
  |000123    |201512  | 100      | 75  |  
  |          |201601  | 200      | 100 |
  |          |201602  | 0        | 0   |
  |          |201603  | 0        | 0   |
  |          |201604  | 250      | 110 |  
  --------------------------------------
  |000145    |201512  | 100      | 75  |
  |          |201601  | 200      | 100 |
  |          |201602  | 250      | 110 | 
  |          |201603  | 0        | 0   |   
  |          |201604  | 550      | 110 |
  ======================================
  </code></pre>
  
  <p>I tried doing a right join the ProjectReportData with the Months table,
  this will fill the missing months.</p>
  
  <pre><code>|ProjectNo | Period | Billing | WIP  |
  ======================================
  |000123    |201512  | 100      | 75  | 
  |000123    |201601  | 200      | 100 | 
  |NULL      |201602  | NULL     | NULL|
  |NULL      |201603  | NULL     | NULL| 
  |NULL      |201604  | NULL     | NULL|  
  |000145    |201512  | 100      | 75  |
  |000145    |201601  | 200      | 100 |
  |000145    |201602  | 250      | 110 | 
  |NULL      |201603  | NULL     | NULL|    
  |000145    |201604  | 550      | 110 |
  ======================================
  </code></pre>
  
  <p>But i need the ProjectNo also to be filled instead of NULL.</p>
  
  <p>How can i acheive this. Please suggest.</p>