On 24-11-2013 17:10, Joseph L. Casale wrote:
Hey guys, Trying to create a statement for use with parameters in a Python execute method when performing inserts with multiple nested selects. I can adjust it for use with Python, but I am having issues when there is more than one nested select.Something such as: INSERT OR IGNORE INTO table_a ( col_a, col_b, col_c, col_d ) SELECT col_a FROM (SELECT id FROM table_b WHERE name=?) ,? ,? ,SELECT col_d FROM (SELECT id FROM table_c WHERE name=?); Anyone have a hint on how to perform such as query?
sqlite> create table test (a integer, b integer, c integer); sqlite> insert into test (a,b,c) values (1,2,3); sqlite> insert into test (a,b,c) values (select 4,2,3); Error: near "select": syntax error sqlite> insert into test (a,b,c) values ((select 4),2,3); sqlite> select * from test; 1|2|3 4|2|3 sqlite> _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

