This content has been marked as final. Show 6 replies
Use a stored procedure. That's the best way to update multiple tables using a DW behavior.
Or you could also create a trigger on table A.
Just curious, why are you storing a count? What will it be used for?
Thank you all for your advice. I will search for examples or tutorials of stored procedures and triggers.
As for why...I breed Cats and am trying to develop a database to help keep track of things.
the first table is a listing of litters like
id #, dob, father, mother, litter size
the other table is a list of cats,
cat name, litter number (the id from first table), size of litter, and the diffrent traits I track.
When a new litter is born I can create a new litter number with a diffrent form.
then after the litter number is assigned, I want to use the form I am trying to build now, to insert the details of the new cats into the second table (the list of cats) and to increase the size of litter by one.
that way I dont have to open phpmyadmin and edit the size of litter column of the first table.
>I want to use the form I am trying to build now, to insert the details of the
>new cats into the second table (the list of cats) and to increase the size of litter by one.
Normally you don't want to store aggregate data in the table. There can be exceptions to this rule, but in most cases your database design should allow for a simple query to report this attribute. Your current design would allow you to find the size of the litter without having to store that value in the table.
Ok thank you I will try to research using a query as a link in a table as well as the other options...hopefully between the 3 I can figure something out that works :)