在两列之间匹配一些单词 [英] Match some words between two columns

查看:106
本文介绍了在两列之间匹配一些单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在两列之间匹配一些单词.我无法在任何地方找到此解决方案,所以我需要帮助.

I need to match some words between two columns. I am not able to find this solution anywhere, so i need help.

|==========title=================|======title================|
|...Toscano Brioche..............|...Toscano .... ...........|
|....Toscano Brioche Creme.......|...Brioche Creme Butter....|

OUTPUT ==>

OUTPUT==>

|==========title=================|======title================|===OUTPUT===|
|...Toscano Brioche..............|...Toscano .... ...........|   1        |
|....Toscano Brioche Creme.......|...Brioche Creme Butter....|   1        |
|....Strawberry CAKE Bakery......|...Brioche Creme Butter....|   0        |

如何比较表中名为"title"的这两列,我需要在这两列之间匹配一些单词.例如,在第1行中,"Toscano"在两列中都是通用的;在第2行中,奶油蛋卷"是通用的.

How to compare these two columns named 'title' in table, I need to match some words between the two columns. For example, in row 1, 'Toscano' is common in both columns, in row 2, 'Brioche Creme' is common.

推荐答案

也许是这样的(SQL FIDDLE 这里)?

Maybe something like this (SQL FIDDLE here) ?

SELECT table1.title title1, table2.title title2
FROM table1, table2
WHERE table1.title LIKE CONCAT('%',table2.title,'%') 
OR table2.title LIKE CONCAT('%',table1.title,'%');

这篇关于在两列之间匹配一些单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆