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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting records with a join in the criteria

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi there,

I am trying to delete records from a table called ScheduleDocuments but I don't want to touch the Documents table - I'm just using that to check the FolderID. If I do a SELECT statement it shows the records I want to to delete but when I try and do a DELETE statement it says there is an error.

Where am I going wrong please?

Code:
DELETE 
FROM ScheduleDocuments
LEFT JOIN Documents ON ScheduleDocuments.DocID=Documents.DocID 
WHERE ScheduleDocuments.ScheduleID=6 
AND Documents.FolderID=123

Thanks!

Ed
 
Code:
DELETE FROM ScheduleDocuments
FROM ScheduleDocuments
INNER JOIN Documents ON ScheduleDocuments.DocID=Documents.DocID AND Documents.FolderID=123
WHERE ScheduleDocuments.ScheduleID=6



Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top