Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL Question - Delete through tables...

SQL Question - Delete through tables...

From: Sean Dolan <dolans_at_stripe.Colorado.EDU>
Date: 26 Feb 99 16:10:50 GMT
Message-ID: <dolans.920045450@stripe.Colorado.EDU>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US