MySQL Forums
Forum List  »  German

Abfrage über zwei Tabellen - tab1 enthält nicht
Posted by: Andy Milster
Date: December 21, 2018 12:42AM

Hallo Gemeinde,

ich stehe vor folgendem Problem:

tab1 (ca 250.000 DS) (NAME ist hier unique)

NAME KINDER

Peter 1
Johann 2
Maria 1

tab2 (ca 10.000.000 Einträge) (NAME ist NICHT unique)

NAME

Anna
Peter
Johann
Uli
Maria
Anna
Uli
Anna

Es sind keine Fremdschlüssel definiert.

Kann ich mit

SELECT tab1.NAME, tab2.NAME FROM tab1 LEFT JOIN tab2 ON NOT tab1.NAME=tab2.NAME

all die DS in tab2 finden, die nicht in tab1 enthalten sind? Und wie kann ich diese löschen?

DELETE FROM tab2 WHERE NOT tab1.NAME=tab2.NAME


Danke für Eure Bemühungen
Andy

Options: ReplyQuote


Subject
Views
Written By
Posted
Abfrage über zwei Tabellen - tab1 enthält nicht
599
December 21, 2018 12:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.