I am working with a table that contains credit transactions where I want to display who\'s credits were spent when a sale is made.
In the table:
Cre
since you mentioned there will be 4 to 5 million records per year, even if this can be done by query it will be an slow query.
I would suggest to have another table like creditSpent
which contains (PurchaseCreditLogId , additionCreditLogId, Amount)
And in the time of inserting purchases, find all records, calculate the amount that should be reduced from each one and store that information in that table
Then when you are running your report you can do a simple query on this table