I have a Table1 with structure as follows:
Database name value
SYSTEM SCOTT 2
SYSTEM SCOTT 4
SYSTEM SCOTT 5
ORCL TEST 4
ORCL TEST 5
ORCL TEST 7
Another Table2 with structure as follows:-
Database1 name1 value1 database2 name2 value2
Now, I want a query which will insert the values from Table1 to Table2, such that the Table2 will appear as shown below:-
Database1 name1 value1 database2 name2 value2.
SYSTEM SCOTT 2 ORCL TEST 4
SYSTEM SCOTT 4 ORCL TEST 5
SYSTEM SCOTT 5 ORCL TEST 7
How can I achieve this table? I am guessing that some GROUPBY operations will give me the result, but I am not getting the exact query for this.
You can do it using Insert & Union operation simply ..