Reputation: 1564
have two table. tbl1:
col1 col2 col3
A A Alex
and tbl2 :
id name
1 John
2 Nen
3 Bob
Want enter all names which is in tbl2 to the tbl1 col3, col1 and col2 must be former, for example i want like this :
col1 col2 col3
A A Alex
A A John
A A Nen
A A Bob
I try something like this :
insert into tbl1(col1,col2,col3)
values('A','A',(select name from tbl2))
but have an error : Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression
Upvotes: 0
Views: 552
Reputation: 8109
You can Try Like This...
insert into tbl1(col1,col2,col3)
Select 'A','A',name from tbl2
Upvotes: 2