Igor,

On Fri, Oct 25, 2013 at 3:26 PM, Igor Tandetnik <i...@tandetnik.org> wrote:

> On 10/25/2013 5:53 PM, Igor Korot wrote:
>
>> If I do something like this:
>>
>> CREATE TRIGGER AFTER INSERT
>> {
>> SELECT max( current_rank ) AS a FROM leagueplayers WHERE leagueid = 1;
>> UPDATE leagueplayers SET current_rank = a WHERE leagueid = 1 AND
>> current_rank IS NULL;
>> }
>>
>
> Something along these lines might work, but the syntax is all wrong. You
> are thinking of something like this:
>
> CREATE TRIGGER leagueplayers_insert AFTER INSERT on leagueplayers
> BEGIN
>   UPDATE leagueplayers SET current_rank = 1 + (
>     select max(current_rank) from leagueplayers WHERE leagueid = 1)
>   WHERE rowid = new.rowid and  leagueid = 1;
> END;


Thank you for correcting the syntax. Yes, that's what I was thinking.


I will try to make the changes and let you know if it will work.

Thank you.


>
> --
> Igor Tandetnik
>
> ______________________________**_________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<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