• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

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

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
brettanderson77
Asked:
brettanderson77
  • 2
2 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
delete tableA where exists ( select null from tableb where tableb.attributex = tablea.attributeX )
0
 
Rey Obrero (Capricorn1)Commented:
delete * from
tableA
where [attribute X] in (select [attribute X] from tableB)
0
 
brettanderson77Author Commented:
THANKS guys, I know you were first Angel but I prefer the simplicity of the second answer :-)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
note that the EXISTS() method is usually more performant...
anyhow, glad we could help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now