Table structure in Yii2

Hi, I am using Yii2 basic application template.

I have two tables with following table structure:

  1. offering
  • OfferingId - Primary key
  • CommunityType
  • ChurchId
  • DateOfOffering
  1. offeringdetails
  • OfferingDetailsid - Primary key
  • OfferingId - Foreign key
  • Type
  • Amount

The scenario is One offering has many offering details for eg,

Now the situation is I want to calculate all the amounts and store the sum as Final amount in some field. So where should I add third coumn in second table or should I create another table which stores the OfferingId and the final amount.

What’s the difference between amount and final amount?

As shown in image this is the second table. So I want to sum all the amounts type of OfferingId 4 and store the Sum of amounts i,e 19000 in some another column.

image