Solved

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

Posted on 2007-11-23
4
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

695 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