Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Query problem 1

Status
Not open for further replies.

GreenFella

Programmer
Oct 23, 2001
41
CA
I am currently working with a delete query and two joined tables.

I wish to delete all records that fit criteria made up of one field from each table.

I only want to delete the records from one table. This is the SQL which I am using to do this...

DELETE Claim.*
FROM Claim INNER JOIN ActivityLog ON (Claim.StatusKey = ActivityLog.Status) AND (Claim.ClaimNumber = ActivityLog.ClaimNumber)
WHERE (((Claim.StatusKey)=11) AND (([Date]+45)<=Date()));

I want to delete all records from the Claim table where the claim is cancelled (Claim.StatusKey = 11) and has been cancelled for 45 days or more (ActivityLog.Date + 45 <= Date()).

When I try to run this query I get the following message:

Operation must use an updatable query.

I have tried to rework this query with no success.

Does anyone have any thoughts as to where I can go from here.

Thanks
GreenFella
 
DELETE Claim.*
FROM Claim
WHERE ((Claim.StatusKey)=11) and claim.claimnumber IN (select activitylog.claimnumber from ActivityLog where ActivityLog.Status = Claim.StatusKey and activitylog.claimnumber = Claim.ClaimNumber And (ActivityLog.Date + 45 <= Date()));
 
Thanks alot for your help.

Worked like a charm.

GreenFella
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top