On 7 Feb 2014, at 11:03am, Constantine Yannakopoulos <alfasud...@gmail.com> 
wrote:

> I would like to create a trigger on table CustomerTrans that performs the
> accumulation of transaction amounts in CustomerAccum. This trigger should
> - Insert a record with the transaction amount if a record for the
> customerid does not exist
> - Update an existing record, adding the transaction amount to the
> cumulative amount.

Don't do it like that.

Use 'INSERT OR IGNORE' to insert a record with a zero amount.
Then update the record which, now, definitely does exist.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to