E
egun
Let's say I have a sub-table (Table B) that is linked to my main table (Table
A) in a many-to-one relationship. The tables are linked via "Parent ID" in
Table B and "ID" in Table A. Since I did not enforce referential integrity
in the relationship from the beginning, Table B has entries that do not have
a parent in Table A because the record in Table A has been deleted.
How can I design a query to show me how many "rogue" entries there are in
Table B (Select) and then a query to delete only those rogue entries (Delete)?
Also, can I then turn on referential integrity so that in the future when I
delete a record from the main table, any linked items in the sub-table will
be deleted?
Thanks,
Eric
A) in a many-to-one relationship. The tables are linked via "Parent ID" in
Table B and "ID" in Table A. Since I did not enforce referential integrity
in the relationship from the beginning, Table B has entries that do not have
a parent in Table A because the record in Table A has been deleted.
How can I design a query to show me how many "rogue" entries there are in
Table B (Select) and then a query to delete only those rogue entries (Delete)?
Also, can I then turn on referential integrity so that in the future when I
delete a record from the main table, any linked items in the sub-table will
be deleted?
Thanks,
Eric