query help

From: www.douglassdavis.com <douglass_davis_at_earthlink.net>
Date: Thu, 21 Feb 2008 06:02:53 -0800 (PST)
Message-ID: <77c99dd7-b4e5-4d8a-963d-88e849fd06d5@u69g2000hse.googlegroups.com>

Say I have two tables:


a_id (primary key)


b_id (primary key)

there is a one to many mapping between rows in table b and rows in table a.

Say I had an Id of a row in table a an (a_id, say 5). Now, what I want to do, is delete the row in table_a (easy enough), but I also want to delete related rows in table_b, if they are ONLY related to the a_id of 5.

In other words, I want to delete the row from table b (related to a_id), but I don't
want to delete the row from table b that may be in use by another row in
table a.

How could I construct a query (or 2) to do that? Received on Thu Feb 21 2008 - 08:02:53 CST

Original text of this message