Select data from one table not in another SQL Server
Method 1:
Method 3:
Method 4:
Method 5:
Method 1:
SELECT t1.name
FROM table1 t1
LEFT JOIN table2 t2 ON t2.name = t1.name
WHERE t2.name IS NULL
Method 2:
SELECT name
FROM table2
WHERE name NOT IN
(SELECT name
FROM table1)
Method 3:
SELECT name
FROM table2
WHERE NOT EXISTS
(SELECT *
FROM table2
WHERE table1.name = table2.name)
Method 4:
SELECT name
FROM table2
WHERE name NOT IN
(SELECT name
FROM table1)
Method 5:
select id, name from table1
minus
select id, name from table2
0 comments: