title: run sql query from two tables with where clause from one table
body: <p>I want to get records from one table based on a record from another table. They both have SSN fields and I want to link them by SSN.
  Here is a rough example what I want to get:</p>
  
  <pre><code>SELECT SUM(Table1.Payments) 
    FROM Table1 
   WHERE Table1.SSN = Table2.SSN 
     AND Table2.City = 'New York'
  </code></pre>
  
  <p>I want to get the sum of the payments by a variable in this case, city.</p>