Table 1
SchoolId_1 Name
Table 2
SchoolId_2 Name
SchooldId_1
and SchooldId_2
have different values. Name have similar but not the same values.
In Table 1, I got name column value 'University of Maine -- Farmington'. In Table 2, I have 'University of Maine at Farmington'. I want to join these but sql skips them because they are not exactly the same.
Table1
University of Strathclyde
University of Maine Fort Kent
Bryn Athyn College of the New Church
Adirondack Community College
Allen Community College
Nova Scotia Community College
Unity College
Allen College
Table2
University of Strathclyde -- Glasgow
University of Maine at Fort Kent
Bryn Athyn College
Unity College
Allen College
I want to join them using the name column with values stated above and the results will be like
SchoolId_1 Name SchoolId_2
1 University of Strathclyde 1101
2 University of Maine Fort Kent 1102
3 Bryn Athyn College of the New Church 1103
4 Adirondack Community College NULL
5 Allen Community College NULL
6 Nova Scotia Community College NULL
7 Unity College 1104
8 Allen College 1105
I tried LIKE, CHARINDEX but they require Name columns to have exactly the same values.
Current code (but only returns exactly the same name values):
SELECT
dsa.SchoolId_1, dsa.Name, ds.SchoolId_2, ds.sch_address, ds.city, ds.sch_state
INTO
match_sch
FROM
dbo.sa_schools dsa
LEFT JOIN
dbo.school ds ON dsa.Name = ds.Name;