Each article has a form. A form consists of a field and value.
For a given article, I want a list of similar articles that have the same fields and values.
Example 1(100% match): ArticleId 113 has 13 fields. ArticleId 89 has 12. It's a 100% match because the field 13 has no value in the articleId 113.
Example 2(92% match): ArticleId 113 has 13 fields. ArticleId 71 has 12. The difference is in the field 13, which exists and has a value in the articleId 113 and does not exists in the articleId 71.
Example 3 and 4 are only illustrative to demonstrate what is intended.
The trick here is in the first example, where although the number of fields is different, the output needs to be 100% match.
Any ideas on how to build a SQL query to perform the output as shown in the image above? I already tried to SELECT the form table and then perform a JOIN on it again but it always fails for the first scenario.
question from:
https://stackoverflow.com/questions/65903561/get-percentage-of-similar-form-records-by-category 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…