I have two tables.
Table A
+----+-------+--------+-------+-------+
| ID | First | Middle | Last | Time |
+----+-------+--------+-------+-------+
| 1 | John | Alan | Smith | 12:38 |
+----+-------+--------+-------+-------+
| 2 | John | Alan | Smith | 1:24 |
+----+-------+--------+-------+-------+
| 3 | John | Alan | Bauer | 1:24 |
+----+-------+--------+-------+-------+
| 4 | Sam | Paul | West | 10:04 |
+----+-------+--------+-------+-------+
Table B
+----+
| ID |
+----+
| 2 |
+----+
| 4 |
+----+
From this, I need to create a SELECT query to get the rows of Table A with First, Middle and Last values that match the First, Middle and Last values for the IDs in Table B.
In other words, I need to get
Table C
+----+-------+--------+-------+-------+
| ID | First | Middle | Last | Time |
+----+-------+--------+-------+-------+
| 1 | John | Alan | Smith | 12:38 |
+----+-------+--------+-------+-------+
| 2 | John | Alan | Smith | 1:24 |
+----+-------+--------+-------+-------+
| 4 | Sam | Paul | West | 10:04 |
+----+-------+--------+-------+-------+
So we selected row 2 and row 4, since they were in Table B, but we also selected row 1 because its First, Middle and Last values matched those in row 2.
We didn’t select row 3 because its Last value wasn’t in any of the rows from Table B.
I hope this makes sense. I’m not sure how to go about this. I was thinking about using a FULL OUTER JOIN on A and B, but then I wasn’t sure how to select the similar rows from there.
This should do the trick: