Subject Re: [firebird-support] Foreign Key on update and after update trigger
Author Dimitry Sibiryakov
09.02.2016 13:16, Svein Erling Tysvær setysvar@... [firebird-support] wrote:
> Then you should have a separate process that at set times (e.g. once every hour, day or
> week), does something like:
> for select DistinctField, sum(MySummationField) from twarehouse_sum group by 1
> into :DistinctField, :MySum do

I would add here "having count(*) > 1" to avoid unnecessary work.

> begin
> delete from twarehouse_sum where DistinctField = :DistinctField;
> insert into twarehouse_sum(DistinctField, SummationField)
> values(:DistinctField, :MySum);
> end