i have 2 tables, lets say:
table1(id bigint) and table2(id bigint)
so i want to select all rows on table1 that does not exist on table2, i have this in place:
SELECT * FROM TABLE1 AS T1
WHERE (CASE WHEN EXISTS(SELECT TOP 1 ID FROM TABLE2 WHERE ID = T1.ID) THEN 1 ELSE 0 END) = 0
this query takes a lot from the processor and too hard on my server, both of those tables have about 100000 rows. So i need another better solution to this.