I have a query with just only 2 tables. Tables are related as one to many by ID field.
I use subquery which gonna check all rows with same ID from second query.
When I use exists predicate - everything works, when I add not to exists - quesry hangs...
l)); I'v get recomendation to use instead
But this code returned for me records from table1 which don't have records with same ID in table2
I use subquery which gonna check all rows with same ID from second query.
When I use exists predicate - everything works, when I add not to exists - quesry hangs...
Code:
select ID1 from table1 where table1.numfield>0 and not exists (SELECT ID2 FROM table2 where table2.ID2=table1.ID1 and (Status>0 or inDate is null or outDate is nul
Code:
select ID1 from table1 left join table2 on (table2.ID2=table1.ID1 and (table2.Status>0 or table2.inDate is null or table2.outDate is null)) where table1.numfield>0 and table2.ID2 is null