Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating triggers
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00425998
Message ID:
00426017
Vues:
35
>Hi all,
> Here's a simple problem that I can't quite figure out. I'm creating a database to keep track of donations. Contacts are in one table, and donations are in another. I want to create an update trigger to test if the amount was changed and, if so, add the amount to the persons total in the contacts table; but if the amt was not changed, to leave the total unchanged.

Are you keeping the sum of the amount donated for each contact in the Contacts table? IOW, if contact John Smith has made 3 donations (3 records in the Donations table), each of $100, are you storing $300 in the Contacts table?

If so, you may want to rethink this design. You can create a view of the Contacts and Donations table that calcuates this amount on the fly. It should be fast, and you won't have to worry about:

1. Maintaining the code to keep track of updates
2. Worry about system crashes that record the update to the Donations record, but not the Contacts table.
Chris McCandless
Red Sky Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform