sql - Adding values from two table and storing into third table -


insert table1 (amount, contactname, state, city)  values  (     (select amount table2 id=12)+     (select amount table3 id=13),     'sam',newyork,'newyork' ); 

i trying store value of amount in table1 sum of table2 + table3 amount

you try way:

insert table1 (amount, contactname, state, city)  values  (      select sum(amount) amount        (select amount table2 id=12              union              select amount table3 id=13),     'sam',newyork,'newyork' );