Ich habe Probleme beim Abgleich von Daten aus 2 verschiedenen Tabellen. Beispiel Tabelle1: a, b, c, d, e (col) Tab.2: a, d, e, f, g (col)Matching Daten in zwei verschiedenen Tabellen (Daten vergleichen)
Wie mit table2 Daten in Tabelle 1 col a, d, e entsprechen col a, d, e in Bedingung, wenn Zeile in Tabelle1 mit Zeile in Tabelle2 übereinstimmt, dann Schleife stoppen?
In meinem Skript Ergebnis immer duplizieren, während die Daten übereinstimmen (wenn Daten in Tabelle1 seine noch Schleife nicht mit den anderen Daten in Tabelle2 gesperrt).
select distinct x.a, y.a, x.d, y.d, x.e, y.e
from table1 x,
table2 y
where x.a = y.a(+) and x.d = y.d(+) and x.e = y.e(+)
leid für mein schlechtes Englisch ...
Edit:
leider kann ich nicht geben gut Smartphone .. vielleicht wie folgt ..
tabelle1
col a--b--c--d--e
1st_row 'Ryan'--'Sofia'--'Bulgaria'--'January'--'107'
2nd_row 'Dony'--'Vienna'--'Austria'--'March'--'103'
3rd_row 'Ryan'--'Berlin'--'Germany'--'January'--'107'
4th_row 'Dony'--'Milan'--'Italy'--'March'--'103'
Tabelle2
col a--d--e--f--g
1st_row 'Ryan'--'January'--'107'--'Travel'--'5'
2nd_row 'Ryan'--'January'--'107'--'Bussiness'--'4'
3rd_row 'Dony'--'March'--'103'--'Bussiness'--'9'
4th_row 'Dony'--'March'--'103'--'Bussiness'--'3'
in meiner Anfrage
select distinct x.a, y.a, x.d, y.d, x.e, y.e
from table1 x,
table2 y
where x.a = y.a(+) and x.d = y.d(+) and x.e = y.e(+)
Ergebnis sind
table1 1st_row matched with table2 1st_row
table1 2nd_row matched with table2 3rd_row
table1 3rd_row matched with table2 1st_row (match duplicated)
table1 4th_row matched with table2 3rd_row (match duplicated)
aber mein gewünschtes Ergebnis ist tabelle1 1st_row abgestimmt mit table2 1st_row tabelle1 2nd_row abgestimmt mit table2 3rd_row tabelle1 3rd_row abgestimmt mit table2 2nd_row table1 4th_row stimmt mit table2 überein 4th_row
einige Beispieltabellendaten und das erwartete Ergebnis hinzufügen - auch formatierten Text. – jarlh
jarlh bitte überprüfen Sie meine Beispieldaten und erwartetes Ergebnis bei meiner antworteten Antwort, thx – hdy