views:

20

answers:

2

i would like to write

insert into tbl1(a,b)
select 123, (select id from tbl2 where status=987)

the problem is, only one row is inserted instead of many rows. How do i fix this? using Sqlite.

+1  A: 

did u try tis?

insert into tbl1(a,b)
select 123, x.*
  from (select id from tbl2 where status=987) x
kartheek
this works as well. +1
acidzombie24
Nested selects are useless here!
Benoit
+3  A: 

Why not :

insert into tbl1(a,b)
select 123, id
  from tbl2
 where status = 987;

?

Benoit