MySQL InnoDB Cascade Rule that looks at 2 columns?

Posted by Travis on Stack Overflow See other posts from Stack Overflow or by Travis
Published on 2010-06-12T18:18:23Z Indexed on 2010/06/12 20:03 UTC
Read the original article Hit count: 250

Filed under:
|
|
|
|

I have the following MySQL InnoDB tables...

TABLE foldersA (
 ID
 title
)

TABLE foldersB (
 ID
 title
)

TABLE records (
 ID
 folderID
 folderType
 title
)

folderID in table "records" can point to ID in either "foldersA" or "foldersB" depending on the value of folderType. (0 or 1).

I am wondering:

Is there a way to create a CASCADE rule such that the appropriate rows in table records are automatically deleted when a row in either foldersA or folderB is deleted?

Or in this situation, am I forced to have to delete the rows in table "records" programatically?

Thanks for you help!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql