Solved

Delete QUery Help Needed for items in multiple tables

Posted on 2011-02-26
3
243 Views
Last Modified: 2012-05-11
Guidence needed on delete query.  I want to delete all items in table 1 that are in table 2.  
select * from table 1
table1 join on table2 table1.c#=table2.C# works. when I add delete * instead of the select it grumbles...

 
0
Comment
Question by:kat50
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34988842
You don't need the * for delete, as you can't delete specific columns you can only delete the whole row.
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 34988844
delete
from table1
where table1.c# in (select c# from table2)
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34988854
Even though you obviously completely ignored my comment, just thought i'd point out that using IN is a lot slower than using JOIN syntax.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now