-5

Write a query that finds all records with the same Last Name, First Name, and State in tables named "Table 1" and "Table 2" that have an age greater than 45.

The "Table 1" table columns are "Last Name", "First Name", "State", and "Age"

The "Table 2" table columns are "Last Name", "First Name", and "State"

1 Answers1

0

Not tested on SQL, but you can just do something like this, if you need to remove duplicates then its another story.

Select p.* 
from [Table 1] p 
inner join [Table 2] q 
    on p.FirstName = q.FirstName 
   and p.LastName = q.LastName 
   and p.State = q.State 
where p.Age > 45

I would suggest to try something on your own and analyze your results.

Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
Anand Verma
  • 263
  • 4
  • 10