Hi ihr,
mir kommt da heute noch eine ganz andere Variante. Was wäre, wenn man einfach zählt wieviele Übereinstimmungen denn da sind?
Schritt 1: Vinzenz Vorschlag mit dem Self-Join, damit wir wirklich zwei Datensätze vergleichen können.
Schritt 2: Eine Summe von IF-Anweisungen der Form:
SELECT
linketabelle.id,
rechtetabelle.id,
(IF(linketabelle.name = rechtetabelle.name, 1, 0))
+
(IF(linketabelle.vorname = rechtetabelle.vorname, 1, 0))
+
...
AS matches
FROM tabelle AS linketabelle, tabelle AS rechtetabelle
WHERE linketabelle.id <> rechtetabelle.id
AND matches > 2
Dieses Konstrukt wächst auch nicht so schnell, weil es pro möglicher Übereintimmung nur ein Summand mehr wird.
MfG
Rouven
--
-------------------
"I wish it need not have happened in my time" - "So do I, and so do all who live to see such times. But that is not for them to decide. All we have to decide is what to do with the time that is given us." -- J.R.R. Tolkien: "The Lord Of The Rings: The Fellowship Of The Ring"
-------------------
"I wish it need not have happened in my time" - "So do I, and so do all who live to see such times. But that is not for them to decide. All we have to decide is what to do with the time that is given us." -- J.R.R. Tolkien: "The Lord Of The Rings: The Fellowship Of The Ring"