[英]How to check if a row of the first column is similar to the second?
我使用查询
Select t1.name as first, t2.name as second From products t1, products t2
这将创建如下两列。 (A,B用于说明目的)
查询之前
-name-
A
B
C
D
E
查询后
-first- -second-
A A
B A
C A
D A
E A
A B
B B
C B
D B
E B
如何检查第一列的行是否与第二列相似?
更新
我运行MySQL
具有相似性,我的意思是要发现它们的相似性百分比更多是指定值。 就像如果第一个包含this is a string
,第二个i wear a string
则存在一定百分比的相似性。 如果该百分比大于70,则它们相似。
有很多方法,这里有一种方法可以为您提供符合您条件的所有产品(第一种=第二种)
SELECT
t1.name AS first, t2.name AS second
FROM
products t1, products t2
WHERE
t1.name = t2.name
或者,如果您需要所有值
Select
t1.name as first t2.name as second, (if t1.name = t2.name THEN 1 ELSE 0) as match
From
products t1, products t2
好,这是要做的事。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.