Igor Korot wrote:
> On Fri, Oct 25, 2013 at 2:12 AM, Clemens Ladisch <clem...@ladisch.de> wrote:
>> Igor Korot wrote:
>>> 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.

>>> Is there a way to do that or I will have to change the query to do a
>>> transactional routine?
>>
>> You could create a temporary table with such a column.
>
> And then how do I use it?

CREATE TEMP TABLE t(playerid, leagueid, auto_rank INTEGER PRIMARY KEY);
INSERT INTO t(playerid, leagueid) SELECT players.playerid, %d FROM ...;
INSERT INTO leagueplayers(playerid, leagueid, current_rank, original_rank)
  SELECT playerid, leagueid, auto_rank, auto_rank FROM t;
DROP TABLE t;


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

Reply via email to