Solved

Delete QUery Help Needed for items in multiple tables

Posted on 2011-02-26
3
269 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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