in reply to Sqlite DBI duplicate record

Something like this:

insert into table (col1, col2, ...) ( select newval_or_expression, col2, ... from table where ... )
Note: SQLite may or may not allow this nested operation. (thanks roboticus)

--MidLifeXis

Replies are listed 'Best First'.
Re^2: Sqlite DBI duplicate record
by roboticus (Chancellor) on Mar 07, 2013 at 19:28 UTC

    MidLifeXis:

    It doesn't have to be nested. SQLite is fine with insert (cols) select ...:

    14:28 METABASE.DFLT: create table foo (a int, b text); 0 affected, 1 sec. create table bar (a int, b text); 0 affected, 0 sec. insert into bar (a, b) values (1, 'bing') 1 affected, 0 sec. insert into bar (a, b) values (2, 'bop') 1 affected, 0 sec. insert into foo (a, b) select a, b from bar 2 affected, 0 sec. select * from foo a b 1 bing 2 bop 2 rows elapsed time: 0

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.