Solved

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

Posted on 2007-11-23
4
246 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 142

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 142

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

Suggested Solutions

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

773 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