Consider two sql-server table columns
Column1 Column2
mr white james bond james cameron
gordon ramsay Harry Gordon Selfridge
I need to select these tables are equal by comparing 5 letters match in name. Example
- Name
mr white james bond
andjames cameron
contains common five letter wordjames
. - Name
gordon ramsay
andHarry Gordon Selfridge
contains common five letter wordgordo
.
Is it possible ?. I can match first 5 characters using this
SELECT * FROM table1 A
INNER JOIN table2 B ON UPPER(SUBSTRING(A.name,1,5))=UPPER(SUBSTRING(B.name,1,5))
But can't match all 5 characters possibilities.