query to select non matching records from two tables

Posted by Parthibansk under Sql Server on 2/7/2013 | Points: 10 | Views : 4602 | Status : [Member] | Replies : 2
got two tables with..

want 2 select only non matching records from name column in two tbales




Responses

Posted by: Rameshrajendran on: 2/7/2013 [Member] Starter | Points: 25

Up
0
Down
Use full join

here one example

SELECT d.DepartmentName,e.EmployeeName

FROM Department as d

FULL JOIN Employee as e

ON e.DepartmentID = d.DepartmentID

WHERE e.DepartmentID IS null OR d.DepartmentID IS null

You like,Please answer me
Have a happy coding.
http://dotnet--solutions.blogspot.in

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimi1289 on: 2/9/2013 [Member] Starter | Points: 25

Up
0
Down
You can use NOT IN

SELECT *FROM Table1 WHERE Packet NOT IN (SELECT Packet FROM Table2)

Rimi


Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response