title: If for same column in table 1 value exists in table 2 then add the two values.Else take the previous value from table 2 and then add
body: <p>I have two tables Table 1 and Table  like :</p>
  
  <p>Table 1</p>
  
  <pre><code>ID     Product_Id         Date                        Volume
  1        260       2015-07-21 09:50:37.000             40000
  1        270       2015-07-23 09:50:37.000             60000
  </code></pre>
  
  <p>Table 2</p>
  
  <pre><code>ID          Product_Id          Date                       Volume
  2            260              2015-07-21 09:50:37.000      10000
  2            270              2015-07-22 09:50:37.000      20000 
  </code></pre>
  
  <p>I want to check if Product_Id for a date in table 1 is present in table 2 or not and if it is present then I want to add the two volumes. If not present then I will take the previous value from table 2 and then add.</p>
  
  <p>How to achieve this? I am not getting a single idea to do this.</p>