On 10/24/2013 10:48 PM, Igor Korot wrote:
INSERT INTO leagueplayers SELECT players.playerid, %d, ... ORDER BY
players.rank;
Now my language of choice is C++ and what I'm looking for is a way to
populate the current_rank and original_rank in the leagueplayers table.
They should come up as auto-incremented values.
So in the "INSERT INTO" query instead of "..." I should have some kind of
function or something that will give me values of 1,2,3,4 and so forth.
INSERT INTO leagueplayers
SELECT p1.playerid, :leagueId, count(*), count(*)
FROM players p1 JOIN players p2 ON (p2.rank < p1.rank or (p2.rank =
p1.rank and p2.playerid <= p1.playerid))
GROUP BY p1.playerid;
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users