Assume a set of mailing lists in which individuals may be members of more than one list. I've set up a join table:
members -> members2lists <- lists
If the user wants to remove a member from one list only, it would seem necessary only to delete the appropriate row in the members2lists table. But how do I specify the cascading so as not to leave them as an orphan if they're a member of only one list? In other words, how do I delete a member if and only if they are a member of solely the list I'm removing them from?
I'm using PHP and mySQL with InnoDB tables.