2016-05-11 3 views

Antwort

0
select t1.* from table1 t1 
left join table2 t2 on t1.col1 = t2.col2 
where t2.col2 is null 

Dies ist Standard-Implementierung von Suchdatensatz fehlt.

0

Sie haben t2 Objekt nicht definiert und verwenden left join.

SELECT t1.* FROM table1 t1 
    LEFT JOIN table2 t2 ON t2.col2 = t1.col1 WHERE t2.id IS NULL 
0

Um die Datensätze zu erhalten, die in Tabelle1 existieren, aber nicht in Tabelle2 existieren, benötigen Sie eine left join, keine inner join.

Versuchen Sie folgendes:

select t1.* 
from table1 t1 
left join table2 t2 on t1.col1 = t2.col2 
where t2.id is null -- any non-nullable column will do, best to use pk for performance. 
0

Wenn Sie versuchen, die Daten von t1.c1, um herauszufinden, (t1 = table1, c1 = column1), die dann in t2.c2 vorhanden ist vorhanden ist oder nicht fließt Skript

select t1.c1 from t1 left join t2 on t1.c1=t2.c2

andere weise, wenn Sie nur t1.c1 Daten finden möchten, die nicht in t2.c2 ist dann unter Skript helfen voll

select t1.c1 from t1 where t1.c1 not in (select t2.c2 from t2)

Verwandte Themen