Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-23
4
Medium Priority
?
255 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 800 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 1200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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