Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
select * from emp1
select * from emp2

select * from emp2 as e
where name not in (select name from emp1 where id=e.id)


VB
id  name
5   4444
5   5555
5   2222
5   7777

id  name
5   1111
5   7777
6   4444

id  name
5   1111
6   4444


Above Query result are following. but finally we want 3rd result set by join.but this 3rd result set happens through Co-related query
Posted

1 solution

You need to use LEFT JOIN for it

SQL
select emp2.* 
from emp2 LEFT JOIN emp1 ON emp1.id=emp2.id and emp1.name=emp2.name 
where emp1.name IS NULL
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900