title: How to count after matching across tables without creating new table
body: <p>I have two tables: one (customer_table) with customer IDs (customer_id) and customer states (customer_state), another (purchase_table) with customer IDs (customer_id) and purchases in dollars (customer_purchase). How do I get the sum of purchases by state?</p>
  
  <p>Here is some example data:</p>
  
  <p>customer_table</p>
  
  <p>customer_id: 1101,1102,1103,1104
  customer_state: 'DE','NJ','DE','PA'</p>
  
  <p>purchase_table</p>
  
  <p>customer_id: 1101, 1102, 1103, 1104
  customer_purchase: 300, 256, 29, 418</p>
  
  <p>I tried creating a new table with LEFT JOIN, however there were too many entries for it to successfully compute. Now I'm trying to find a way around altering or creating a new table while still being able to find the sum of purchases by state.</p>