On 9 Sep 2013, at 3:17am, Joseph L. Casale <jcas...@activenetwerx.com> wrote:

> INSERT INTO table_a (val) VALUES ('xxxxxx');
> INSERT INTO table_b (id, key, val)
>       SELECT last_insert_rowid(), 'yyy', 'zzz';
> 
> Just not sure how to perform 20 or 30 of those inserts into table_b after the 
> one into table_a
> yields the id value I need.

Look up the last_insert_rowid() you want and store it in your programming 
language.  That's what programming languages are for.  But if you want to do it 
less efficiently ...

Look it up each time you insert into table_b:

INSERT INTO table_b (id, key, val)
      SELECT id, 'yyy', 'zzz' FROM table_a WHERE val='xxxxxx';

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

Reply via email to