In Oracle, how does one merge two tables with different columns and different rows into one? SQL: www.2cto.com select s. stagename sname, sum (nworkhours) nworkhours, sum (OVERHOURS) OVERHOURS, sum (nworkhours + OVERHOURS) from T_WorkDetails w, t_stage swhere w. stageid = s. stageid and w. projectid = 'd0927380468f4a4ee04010ac0c051f15 'group by s. stagenameORDER by s. stagename:
The second SQL statement is: select sum (total) as temptal from (select s. stagename sname, sum (nworkhours) nworkhours, sum (OVERHOURS) OVERHOURS, sum (nworkhours + OVERHOURS) totalfrom T_WorkDetails w, t_stage swhere w. stageid = s. stageid and w. projectid = 'd0927380468f4a4ee04010ac0c051f15 'group by s. stagenameORDER by s. stagename) is displayed as: www.2cto.com
The result to be displayed is:
Core Idea: select * from (Table A, Table B) the overall SQL statement is as follows: select * from (select s. stagename sname, sum (nworkhours) nworkhours, sum (OVERHOURS) OVERHOURS, sum (nworkhours + OVERHOURS) from T_WorkDetails w, t_stage swhere w. stageid = s. stageid and w. projectid = 'd0927380468f4a4ee04010ac0c051f15 'group by s. stagenameORDER by s. stagename) t1, (select sum (total) as temptal from (select s. stagename sname, sum (nworkhours) nworkhours, sum (OVERHOURS) OVERHOURS, sum (nworkhours + OVERHOURS) totalfrom T_WorkDetails w, t_stage swhere w. stageid = s. stageid and w. projectid = 'd0927380468f4a4ee04010ac0c051f15 'group by s. stagenameORDER by s. stagename) t2) Note: if the number of rows is small, the table automatically matches the table with the number of rows.