Reputation: 39
I'm using Access 2013. I've a Table name - Raw
and its Fields are:
requestid - Number
Formname - Short Text
Timestamp - Date/Time
Type - Short Text
ActionBy - Short Text
Raw
table contains all the data. Same request ID will be having different Types
and actionby
. I want to delete all the rows for those request ID where any of the actionby
for a particular request ID is not matching my user. If matching, leave all the rows.
Example - In the screenshot, request ID 27176 is having Ciaran in actionby. Hence, it should not delete any of the rows for request ID 27176.
However for request ID 27434, ciaran is not in Actionby so delete all the rows for 27176. Hope I'm able to give a glimpse of what I needed.
Upvotes: 0
Views: 56
Reputation: 1269643
You can identify the one to delete using NOT IN
and some string manipulation:
delete from raw as r
where requestid not in (select requestid
from raw as r2
where r2.ActionBy = "Harford, Claran" and
r2.requestid = r.requestid
);
Upvotes: 1