On 28 Aug 2009, at 3:27am, Dennis Volodomanov wrote:

> 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

Instead of keeping your total in abcCount, make another table  
especially for counts

countType       number
abc             27
def             14

and use the TRIGGER to update that table.

But for counts you don't need to do that, since there's an aggregate  
function for counting in SQLite.

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

Reply via email to