Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delete QUery Help Needed for items in multiple tables

Posted on 2011-02-26
3
Medium Priority
?
284 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:
Ephraim Wangoya earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

971 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