我正在寻找一种在包含类似字符串的字段上的2个表之间进行INNER JOIN的方法。这是我的两个表:
表A
ID | Model | Item
1 | CALI FULL RELAX | 3-SEAT-SOFA
2 | TOTO BREAK | ARMCHAIR-BIS
3 |... | ...
表B
IDbis | Modelbis | Itembis | Image
1 | CALI | SOFA | 101.jpg
2 | TOTO | ARMCHAIR | 102.jpg
3 | TOTO | SOFA | 103.jpg
结果将是:
表C
Model | Item | Image
1 | CALI FULL RELAX | 3-SEAT-SOFA | 101.jpg
2 | TOTO BREAK | ARMCHAIR-BIS | 102.jpg
答案 0 :(得分:1)
尝试使用:
SELECT A.MODEL AS MODEL, A.ITEM AS ITEM, B.IMAGE AS IMAGE FROM
TABLE_A AS A INNER JOIN TABLE_B AS B ON A.MODEL LIKE CONCAT('%',B.MODELBIS,%');