Deleting records from one table based on another table

sudhirhinduja

Registered User.
Local time
Today, 12:16
Joined
Aug 17, 2004
Messages
41
Hi folks,

I have 2 tables - Companies and Executives.

I have CompID as PK in Companies and FK in Executives. I have ExecID as PK in Executives.

I want to delete all the companies that do not have an executive in them. Please advise how do I write the query to achieve this.

Thanks,
Sudhir.
 
Don't remember exactly, but I think that the «Not exist» function should help.
 
Thanks Pat n Newman,

Pat I did the same thing.... but it gave an error saying that cannot delete from specified table. I checked with the person who made the tables and he says there's no password protection, so I'm ruling out a permission problem.

What's the next step to take? Please advise....

Thanks,
Sudhir.
 

Users who are viewing this thread

Back
Top Bottom