I have two tables that I want to combine (join) in SQL.
Table 1 Persons:
| Person _Id | First_name | Last_name |
|---|---|---|
| 135790 | John | Smith |
| 246801 | Lucas | Williams |
| 054953 | George | Johnson |
| 460235 | Adam | White |
Table 2 Loans:
| Borrower_Id | resident1_id | resident2_id |
|---|---|---|
| 135790 | 246801 | 054953 |
| 460235 | 054953 | 135790 |
| 054953 | 246801 | 135790 |
The expected result:
| Borrower_FN | Borrower_LN | resident1_FN | resident1_LN | resident2_FN | resident1_LN |
|---|---|---|---|---|---|
| John | Smith | Lucas | Williams | George | Johnson |
| Adam | White | George | Johnson | John | Smith |
| George | Johnson | Lucas | Williams | John | Smith |
How can I join it?