سؤال

I have two similar tables with same columns. I just want to add the data of the column of one table with the corresponding data of the column of another table. Thus, form a new table which consists of the sum of individual data of both the tables. Would you please help me?

هل كانت مفيدة؟

المحلول

something like this?

INSERT INTO myTable 
    SELECT 
        s.salary + t.salary AS salary, 
        s.name 
    FROM table_name s
    JOIN table_name_2 t ON t.name = s.name -- or whatever parameter you use to join the two tables on

نصائح أخرى

you can do like

insert into newTable select * from table1;
insert into NewTable select * from table2; 

this will insert two tables data to new Table.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top