inserting data into one table from multiple tables

Tools
Enthusiast

inserting data into one table from multiple tables

hi
i need to insert data into one table from 2 different tables

i m using like this

insert into table1 values(firstname,phoneno,lastname)
select
fname,
(select t2.phonenumber from table2 t2,table3 t3 where t2.firstname=t3.fname),
lname
from table 3;

i am inserting firstname and lastname from table 3 and i m inserting phoneno from table2

but here i m getting a syntax error 3706 expected something between '(' ans 'select' keyword

can anyone help me plz................
1 REPLY
Enthusiast

Re: inserting data into one table from multiple tables

insert into table1 values(firstname,phoneno,lastname)
select
fname,
(select t2.phonenumber from table2 t2,table3 t3 where t2.firstname=t3.fname),
lname
from table 3;

insert into table1 (fname, pno, lname) values (sel t2.fname, t3.pno, t2.lname from table2 t2, table3 t3 where t2.fname=t3.fname);