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.
Author |
Topic |
tracy5436
Yak Posting Veteran
50 Posts |
Posted - 2010-09-17 : 12:23:48
|
Hi,I am trying to delete records in the sop10200 table which are related to those in the sop10100 for a particular batch numberonly. The two tables are joined by the sopnumbe field. I have used the following query :delete sop10200WHERE exists (select * from sop10100 inner join sop10200 on sop10200.sopnumbe = sop10100.sopnumbe Where bachnumb = 't11')However, when I run it, it deletes all records in the sop10200 table. What am I doing wrong ? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-09-17 : 12:25:36
|
it should bedelete s from sop10200 sWHERE exists (select 1 from sop10100 where sopnumbe = s.sopnumbe and bachnumb = 't11') ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|