Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL Question - Delete through tables...
I am having trouble deleting some records from a database "cleanly". I
could do it successfully with cursors but I'd like to make "one-line" SQL
statements if possible. Below is the scenario (3 tables - I want to clear
everything out of it where contractId = something):
EMAILGROUPS
ID (FK to EmailGroupUsers: GROUPID), GROUPNAME, CONTRACTID
EMAILUSERTYPES
EMAILUSERID (FK to EmailGroupUsers: ID), STATUS, PRIORITYLVL
EMAILGROUPUSERS
ID, TECHID, GROUPID
If I want to delete all entries in emailusertypes that belong to Contract
10000, how would I do it?
delete from emailusertypes where exists (????) - the problem is that I keep deleting ALL the rows from the table instead of those that belong to a certain contract. Is the "exists" the right way to do it?
Any help would be greatly appreciated.
Thanks,
Sean Dolan
Received on Fri Feb 26 1999 - 10:10:50 CST
![]() |
![]() |