Can anyone answer this question How to find only nonmatching records from both tables?
You can try the below query. Just change the table names and column names as per your requirement.
SELECT B.CountryID
FROM TableB AS B
LEFT JOIN TableA AS A ON A.CountryID = B.CountryID
WHERE A.CountryID IS NULL
I will tell you the two ways how you can acheive this.
Consider the below two tables.
Table 1:
EmpID ACT_no NAME
1 19 ddd
2 20 eee
3 21 fff
4 22 adada
5 23 mmmmm
6 24 yyyy
Table 2:
sr no ACT_no Balance
1 19 4000
2 20 5675
3 21 3300
Query 1
select t1.EmpID,t1.ACT_no,t1.Name from table1 t1
left outer join table2 t2 on t1.Act_no_no = t2.Act_no
where
t2.EmpIdD is null
Query 2
select t1.* from table1 t1 where
not exists (
select 1 from table2 t2
where t1.ACT_no=t2.ACT_no
)