Use old.TypeID==1 if you want the trigger to be fired when TypeID WAS 1
before the update, or new.TypeID==1 if you want the trigger to be fired when
TypeID is updated to 1.

Hope this help...

2009/8/28 Dennis Volodomanov <denn...@conceiva.com>

> Hello all,
>
> Is it possible to create such an AFTER INSERT trigger that updates certain
> fields in a table based on the actual data being inserted?
>
> Let's say:
>
> CREATE TABLE abc(TypeID INTEGER)
> CREATE TABLE abcCount(TypeCountA, TypeCountB)
>
> CREATE TRIGGER CountTypeA AFTER INSERT ON abc /* when abc.TypeID == 1 */
> BEGIN
>        UPDATE abcCount SET TypeCountA=TypeCountA+1;
> END
>
> CREATE TRIGGER CountTypeB AFTER INSERT ON abc /* when abc.TypeID == 2 */
> BEGIN
>        UPDATE abcCount SET TypeCountB=TypeCountB+1;
> END
>
> Is something like that possible? I couldn't find any syntax construct I
> could put in place of the comment.
>
> Thanks in advance,
>
>   Dennis
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to