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 |
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-05-19 : 09:48:36
|
| Don't know why I can't seem to manage this, but my mind has gone blank.I have a table:Date ID Valuewith some 3 million records in it. I have a subset of this table (same format, Date ID Value) which I need to delete from this table. Could someone help me out with how I should do this? It's easy to: delete from mytable where date = 'whatever' but how do I perform this when I have to specify both ids and dates? For instance, I get the correct deletion records doing:select * from maintable a,inner join subset bwhere a.id = b.idand a.date =b.datebut how do I use delete with this (in other words, how do I delete all the records of subset b from maintable a given Date + ID)?Any help from a kind soul for a frustrated git would be very much appreciated. |
|
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2005-05-19 : 10:27:04
|
| DELETE aFROM MainTable a INNER JOIN Subset b ON (a.ID = b.ID AND a.Date = b.Date)Dustin Michaels |
 |
|
|
KidSQL
Yak Posting Veteran
88 Posts |
Posted - 2005-05-19 : 10:38:24
|
| Jeez, I knew it was something simple. Thank you very much for your help. |
 |
|
|
|
|
|