im sure this is an easy question, but its been a while since i have done complicated sql. i dont quite remember how to do it.
basically, i have table a, b, and c.
say table a has attributes name, address, city, phone
say table b has attributes address, city
say table c has attributes phone, area_code
how could i do an insert where i can take a value of table b and a value of table c and put those in the corresponding columns in table a.
basically, how could i do this
insert into table a (address, phone) values ((select address from b where city='My City'), (select phone from c where area_code = 111));
better yet, how could i get the input from one table and just input a static value for the second, like this...
insert into table a (address, phone) values ((select address from b where city='My City'), '$my_phone_num');
do you see what I am trying to do? i am wanting to use data from two different tables to insert into a third table.
i cant seem to remember this, and google hasnt helped any.
thanks in advance. i know its simple, im just not sure on the syntax.