Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL - Display "Not Match" result

Author  Topic 

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-02-05 : 10:13:36
I have one SQL statement, i want to display the result that both of the table with NOT MATCH result, is that possible?

For example:
TABLE 1 TABLE 2
-------------- -------------------
ID NAME AGE ID School
1 abc 12 1 Primary YYY
2 def 14 2 University xxx
3 Secondary ooo

I just want display the result which ID = 3

Thanks

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-05 : 10:15:45
[code]Select t1.*
from Table1 t1 LEFT JOIN Table2 t2
on t1.[ID] = t2.[ID]
where t2.[ID] is NULL
[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-02-05 : 19:10:29
it works, thanks Harsh... :D
Go to Top of Page
   

- Advertisement -