A
A
Aldevex2018-02-19 06:56:38
MySQL
Aldevex, 2018-02-19 06:56:38

How to find similar records in the database?

Hello. How to find similar records by at least N (for example, 4) columns in the table
or find out by what number of columns the records match
example
one column | two | tree | four | five
1 | 2 | 3 | 4 | 5
1 | 2 | 3 | 4 | 994
| 2 | 3 | 4 | 99
Records 1 and 2 will be similar, and 2 and 3. values ​​are unknown
Levenshtein distance is not suitable

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
ambalus, 2018-02-19
@Aldevex

SELECT one, two, tree, four, COUNT (five) AS cnt
FROM table
GROUP BY one, two, tree, four
HAVING COUNT (five) > 1

R
Rsa97, 2018-02-19
@Rsa97

To do JOIN tables with it according to the "similarity" condition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question