Reputation: 125
I have 2 table:
Table1
Name Address Phone
Nirdosh Kth 96749343
Hari pokhara 98493434
Table2
Name Address Phone
Shrestha Daldale 96749343
Hari pokhara 98493434
I want to JOIN in Name field which are string in type like this:
select Table1.*,Table2.*
from Table1 actual
INNER JOIN Table2 more
ON LIKE ('actual.Name') = LIKE('more.Name')
But I am getting error.
Upvotes: 0
Views: 25
Reputation: 421
if you think Table2 Name, ie more.name need not be exactly as actual.name, you could use the following
select actual.*, more.*
from Table1 actual
inner join Table2 more on more.Name like concat('%', trim(actual.Name), '%')
Upvotes: 1
Reputation: 311551
You usage of the like
operator is wrong. You can just use the =
operator to compare strings:
SELECT Table1.*,Table2.*
FROM Table1 actual
INNER JOIN Table2 more ON actual.Name = more.Name
Upvotes: 1