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 teh matching records

Author  Topic 

Saeed
Starting Member

39 Posts

Posted - 2003-05-29 : 02:16:29

I have 2 tables
#ValidRoll & #Mylist

#MyList contains 2 columns (MCCN , WarehouseN)

Anything found in ValidRoll matching Mylist (MCCN , WarehouseN )needs to be deleted .

How do I delete the matching records from ValidRoll

Neither of the following statements does not seem to do the job:

1-delete from #ValidRoll where exists (select * from #Mylist as a , #ValidRoll as b where a.MCCN=b.MCCN and a.WarehouseN=b.WarehouseN)

(This one does not work)


2-delete from #validRoll where MCCN =#Mylist.MCCN AND WareouseN = #Mylist.WarehouseN

(This one is not liked by SQL2000)


Any idea what I m not doing or doing wrongly ?

Thanks

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2003-05-29 : 02:20:16
Saeed,


DELETE V
FROM #ValidRoll V
INNER JOIN #Mylist M ON M.MCNN = V.MCNN AND M.WarehouseN = V.WarehouseN


Or something like that.....

DavidM

"SQL-3 is an abomination.."

Edited by - byrmol on 05/29/2003 02:20:45
Go to Top of Page
   

- Advertisement -