Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating triggers
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00425998
Message ID:
00426017
Views:
36
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform