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 |
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-09-30 : 04:59:30
|
Hi,I have this simple querySELECT a.* FROM tblPricing a INNER JOIN tblBannedIDs bON a.id = b.id AND a.[type] = b.[type] What I need to do instead on selecting these rows is to delete them from tblPricing. How can I do that?If only one column was involved I know I could do DELETE FROM tblPricing WHERE id IN (SELECT id FROM tblBannedIDs) but not sure with there being 2 columns needed to filter.Thanks |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-09-30 : 05:17:42
|
[code]DELETE tgtFROM tblPricing AS tgtINNER JOIN tblBannedIDs AS src ON src.ID = tgt.ID AND src.[Type] = tgt.[Type]DELETE tblPricingWHERE EXISTS (SELECT * FROM tblBannedIDs AS x WHERE x.ID = ID AND x.[Type] = [Type])[/code] N 56°04'39.26"E 12°55'05.63" |
|
|
|
|
|