On 25/02/2009 10:19 AM, Leo Freitag wrote: > Hallo, > > I'm trying to insert the highest value of tblName into tblZO. > > There fore I followed the hints in this article ... > http://www.nabble.com/How-to-use-the-ROWID-of-the-last-inserted-row-for-FK-insert-into-other-tables--td19085514.html#a19085514 > > ... but I got a error (see below) > > SQLite version 3.3.13 > Enter ".help" for instructions > sqlite> create 'tblName' ('id' integer primary key, 'text' text); > SQL error: near "'tblName'": syntax error > sqlite> create table 'tblName' ('id' integer primary key, 'text' text); > sqlite> insert into 'tblName' Values (NULL, 'one'); > sqlite> insert into 'tblName' Values (NULL, 'two'); > sqlite> insert into 'tblName' Values (NULL, 'three'); > sqlite> insert into 'tblName' Values (NULL, 'four'); > sqlite> insert into 'tblName' Values (NULL, 'five'); > sqlite> create table 'tblRefMaxName' ('ref' integer, 'nn' text); > sqlite> insert into 'tblRefMaxName' Values (select max(id) from tblName, > 'eins') > ; > SQL error: near "select": syntax error > sqlite>
sqlite> insert into 'tblRefMaxName' Values ((select max(id) from tblName),'eins' ); sqlite> select * from tblRefMaxName; 5|eins sqlite> BTW, don't you find all those '' around your table and column names rtaher irritating? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users