我想加入两个表t1
和t2
,以便t2
中的列值为any valid string including null followed by a value in column of t table
。
我想要类似的东西:
SELECT * FROM t_cities c JOIN temp_table t ON c.NAME LIKE "%t.token"
但不知道确切的sytax。上述陈述当然会出错。
答案 0 :(得分:8)
尝试此查询,它应该可以。
SELECT * FROM t_cities as a
JOIN temp_table as b
ON a.NAME LIKE concat("%",b.token);
注意 - 此查询不会像普通加入一样快,需要时间。
答案 1 :(得分:0)
试
SELECT *
FROM t_cities c
JOIN temp_table t ON c.field = t.field
where c.NAME LIKE "%t.token"