Use not exists keyword to select first table record which does not exist in the second table.
Here, is the Query string
SELECT t1.name FROM
table1 t1
WHERE NOT EXISTS (
SELECT * FROM table2 t2
WHERE t2.id = t1.id)
how to check which record does not exists in one table to another table in sql server?
for example we have two table like table1 and table2 . i want to select all table1 record which does not exists in table2.
Use not exists keyword to select first table record which does not exist in the second table.