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:
SELECT SUM(Table1.Payments)
FROM Table1
WHERE Table1.SSN = Table2.SSN
AND Table2.City = 'New York'
I want to get the sum of the payments by a variable in this case, city.