Solved

Delete QUery Help Needed for items in multiple tables

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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