Solved

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

Posted on 2007-11-23
4
244 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
Comment Utility
delete tableA where exists ( select null from tableb where tableb.attributex = tablea.attributeX )
0
 
LVL 119

Accepted Solution

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

Author Comment

by:brettanderson77
Comment Utility
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]
Comment Utility
note that the EXISTS() method is usually more performant...
anyhow, glad we could help
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now