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)
 deleting values based on another column

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2002-04-04 : 21:06:33

I have 2 tables. tblInstantMessage and tblUserDetails

I am in the process of normalizing the database, I would like to delete all the userID's in tblInstantMessage that do not appear in the UserID of tblUserDetails.

Is there a way to do this?

Thanks
MIke


robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-04 : 21:08:39
DELETE FROM IM
FROM tblInstantMessage IM LEFT JOIN tblUserDetails U
ON IM.UserID=U.UserID
WHERE U.UserID Is Null


Go to Top of Page
   

- Advertisement -