C0L0mb0
C0L0mb0

Reputation: 39

How to delete some records using query

I have two tables equipment and obj_app and using ACCESS 2010. Where one equipment.id_app corresponds to many obj_app.id_app. I've used this query:

SELECT OBJ_APP.ID_APP
FROM equipment   
LEFT OUTER JOIN  OBJ_APP 
ON OBJ_APP.ID_APP = equipment.ID_APP
WHERE OBJ_APP.ID_APP IS NULL

How to delete these records?

Upvotes: 1

Views: 43

Answers (1)

user4039065
user4039065

Reputation:

Regardless of the JOIN, you are simply returning a bunch of NULLs since that is your WHERE criteria and the JOIN mechanism.

DELETE * FROM equipment e WHERE e.ID_APP IS NULL
DELETE * FROM OBJ_APP o WHERE o.ID_APP IS NULL

Upvotes: 2

Related Questions