Solved

ACESS SQL Deleting from a table where values exist in another table

Posted on 2007-11-23
4
251 Views
Last Modified: 2010-03-20
Hi,

I need to delete all from table A where attribute X exists in both table A & table B.

Hope you can help.

Cheers,
Brett
0
Comment
Question by:brettanderson77
  • 2
4 Comments
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 200 total points
ID: 20340289
delete tableA where exists ( select null from tableb where tableb.attributex = tablea.attributeX )
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 300 total points
ID: 20340298
delete * from
tableA
where [attribute X] in (select [attribute X] from tableB)
0
 

Author Comment

by:brettanderson77
ID: 20340358
THANKS guys, I know you were first Angel but I prefer the simplicity of the second answer :-)
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20340364
note that the EXISTS() method is usually more performant...
anyhow, glad we could help
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

839 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