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 2000 Forums
 Transact-SQL (2000)
 not exists

Author  Topic 

bilencekic
Posting Yak Master

121 Posts

Posted - 2006-10-27 : 08:14:10
i have 2 tables
i want records that which doesnt exists on 2nd table.
the have a same column named Word

i tried not exists but coudlnt make it.
select * from firsttable where not exists(Select Word from secondtable)

MS BLESS US

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-27 : 08:27:16
[code]select * from firsttable f where not exists(Select Word from secondtable s where s.Word = f.Word)[/code]


KH

Go to Top of Page

iminore
Posting Yak Master

141 Posts

Posted - 2006-10-27 : 08:30:12
Read about 'joins-SQL Server' in BOL. You need a left join with a null value from the second table.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-27 : 08:44:38
Or use NOT IN keyword.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

bilencekic
Posting Yak Master

121 Posts

Posted - 2006-10-27 : 08:55:34
thx =)

MS BLESS US
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-27 : 09:06:09
Also Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bilencekic
Posting Yak Master

121 Posts

Posted - 2006-10-27 : 09:43:58
lol
sometimes
i forgot basic commands =)
i know very well (i think)

MS BLESS US
Go to Top of Page
   

- Advertisement -