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)
 help to query

Author  Topic 

ibin
Starting Member

26 Posts

Posted - 2009-11-04 : 03:35:21
hi,

I have two tables table1 and table2
table1
t1
t2
t3
table2
t1
t2
t3
t4
I want to delete the items in table2 except the items from table1
i.e finally table2 should contain t1,t2 and t3

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-11-04 : 03:37:53
delete from table2 where col1 not in(select col1 from table1)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -