title: Sum of sale of each partnumber and partnumber have its substitute partnumber in another table
body: <p>I have two table first have part number and sale of each month.
  And another table have substitute part of part number.</p>
  
  <p><strong>Table 1</strong></p>
  
  <pre><code>Partnumber     jun19sale   jul19sale
  A                 1                1
  B                 2                1
  C                 3                4
  E                 5                3
  D                 1                2
  </code></pre>
  
  <p><strong>Table2</strong></p>
  
  <pre><code>Partnumber     subpart   
  A                 B               
  A                 C               
  A                 D  
  </code></pre>
  
  <p>How can i get something like this.</p>
  
  <pre><code>Partnumber     jun19sale   jul19sale
  A                  7               8
  B                  7               8
  C                  7               8
  E                  5               3
  D                  7               8
  </code></pre>
  
  <p>I tried with subqueries with or,in which give me accurate result, but it takes too much time. Because tables have large amount of data.</p>