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 |
pavlos
Yak Posting Veteran
59 Posts |
Posted - 2012-05-27 : 20:19:08
|
Hey guys,I want to delete data from a table where it exists in another table.I have a budget table and a data table. I want to delete the rows of the data table where they exist in the budget table.The data and budget table consists off date, storecode, value.I have tried thisdelete from datawhere date in (select date from budget)and storecode in (select storecode from budget) but this deletes all dates and storecodes where they exist in the budgetI want to delete the rows that have the budget and storecode together.EG.delete from datawhere date and storecode in (select date,storcode from budget)I cant put where clauses in the select statement.hope this makes sense |
|
pavlos
Yak Posting Veteran
59 Posts |
Posted - 2012-05-27 : 20:22:55
|
ignore this guys.worked it outdelete from datawhere exists in (xxxxx)cheers |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-27 : 21:48:31
|
another method is delete with inner join to other table on related fields------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|