Link to home
Start Free TrialLog in
Avatar of Meshman333
Meshman333

asked on

Deleting rows referenced from another table.

I have a table with a ton of duplicate rows I need to remove.  I have it to the point where I have another table, with one field, ID, that contains the ID of the records I want to delete in the other table.

DELETE FROM bigtable WHERE ID = smalltable.ID

I know how I'd do this in something like C# but I'm stumped when it comes to SQL.  How do I run a loop through the smaller 'ID' table and at the same time, delete each of the associated records in the big table?  I probably need a join but how to incorporate the delete?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Chris Luttrell
Chris Luttrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Meshman333
Meshman333

ASKER

Awesome, thanks!