Say I have two tables:

table_a
----------
a_id (primary key)
b_id

table_b
----------
b_id (primary key)
name

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 the related row in table_b, if it is ONLY related to
the a_id of 5.

In other words, I want to delete the row from table b, but I don't
want to delete a row from table b that is in use by another row in
table a.

I'm thinking some type of subquery could do this, but I'm not sure.

Can some one tell me how to do this?

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to