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