A表
def gi
A 11;22;33
B 44;55;66
C 66;22B表
gi_new
22
55
想要通过gi_new月gi字段关联(只要gi_new字段的内容在gi字段中出现即可关联上,如:22包含于11;22;33),得到def结果应该为:
A_B表
gi gi_new def
11;22;33 22 A
44;55;66 22 B
66;22 22 C
44;55;66 55 B我本来想通过模糊连接,貌似语法不支持呀。
如:create table A_B select A.*,B.* from A,B where B.gi_new like '%gi%';想法太天真。。
注:其中A表的记录上千万条
请问如何能够有效得到相应结果。
def gi
A 11;22;33
B 44;55;66
C 66;22B表
gi_new
22
55
想要通过gi_new月gi字段关联(只要gi_new字段的内容在gi字段中出现即可关联上,如:22包含于11;22;33),得到def结果应该为:
A_B表
gi gi_new def
11;22;33 22 A
44;55;66 22 B
66;22 22 C
44;55;66 55 B我本来想通过模糊连接,貌似语法不支持呀。
如:create table A_B select A.*,B.* from A,B where B.gi_new like '%gi%';想法太天真。。
注:其中A表的记录上千万条
请问如何能够有效得到相应结果。
对字符操作速度不会快
from A,B
where charindex(B.gi_new,A.gi)>0
from a,b
where FIND_IN_SET(gi_new,replace(a.gi,';',','));