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...
views:
96answers:
2
+5
A:
SELECT *
FROM table1 t1
JOIN table2 t2
ON t2.name = CONCAT('e', t1.name)
Quassnoi
2009-08-12 18:31:15
+1
A:
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.
northpole
2009-08-12 18:33:01