I want to be able to choose a groupID and do a cascading delete through three tables which are found in a MS SQL server database. The tables look like the following:
table 1 - GROUP
-------------------------------------------
groupID | description | etc
table 2 - MEMBER
-------------------------------------------
memberID | name | etc
table 3 - MAPPINGTABLE
-------------------------------------------
mappingID | groupID | memberID
I'm thinking that since I know the groupID, I could probably select the memberID's from the mapping table based off of the groupID and delete those from the member table, but I usually end up with an error of:
"The DELETE statement conflicted with the REFERENCE constraint...[FK constraint in table]".
Would anyone be able to give me some guidance on the best way to delete from all three of these tables at the same time?
Thanks.