I want to be able to select groupID and perform cascading deletion through three tables that are in the MS SQL server database. The tables are as follows:
table 1 - GROUP
-------------------------------------------
groupID | description | etc
table 2 - MEMBER
-------------------------------------------
memberID | name | etc
table 3 - MAPPINGTABLE
-------------------------------------------
mappingID | groupID | memberID
I think that since I know the groupID, I could probably select the memberID from the mapping table based on the groupID and remove those from the member table, but usually I get the error:
"The DELETE operation is contrary to the REFERENCE constraint ... [FK constraint in the table]."
Can anybody give me some recommendations on the best way to remove these tables from all three at the same time?
Thank.