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!

Deleting records based on a Select query 1

Status
Not open for further replies.

Cads

Technical User
Jan 17, 2000
40
GB
Hi
A database I created a couple of years ago has accumulated some records which should have been deleted by the system (bad design!). What I've decided to do is construct a select query to identify these records and then use this query to delete the offending records and so tidy things up.

However.......

When I create a new query linking the original table containing the records to delete with the select query of 'rogue' records, the delete query that's created comes back with the error message "Could not delete from specified tables". The help system talks about read-only databases and the like but that isn't applicable. To assist, I include the SQL to give you a better understanding of what I'm trying to do:

DELETE Organisations.*
FROM Organisations INNER JOIN tmpqryNoConMem ON Organisations.OrgID = tmpqryNoConMem.OrgID;

The table and the query links 1:1.

Any ideas why SQL / Access doesn't like this?

Cheers!




Steve House
shouse@icaew.co.uk
 
You might try:


DELETE FROM Organisations
Where OrgID IN (Select OrgID From tmpqryNoConMem);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top