Reputation: 1163
I want to join table1 with table2 on column 'Name', but table2.Name has an 'e' in front of all the names (if table1.name=ABC,table2.name=eABC). How am I supposed to use a join for those two?
I tried FROM table1 join table2 on 'e'+table1.name = table2.name
, but it doesn't work...
Upvotes: 2
Views: 354
Reputation: 10346
Try using a substring of the table2 name. So something like:
SELECT *
FROM table1
, table2
WHERE table1.name = substring(table2.name, 1, length(table2.name))
I can't remember if substring is zero based, so just play with the numbers.
Upvotes: 1
Reputation: 425341
SELECT *
FROM table1 t1
JOIN table2 t2
ON t2.name = CONCAT('e', t1.name)
Upvotes: 6