• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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